smplkit 3.0.26 → 3.0.27

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,292 @@
1
+ =begin
2
+ #smplkit Audit API
3
+
4
+ #Append-only change-history substrate for smpl.* resources and customer-application events. ADR-047.
5
+
6
+ The version of the OpenAPI document: 0.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module SmplkitGeneratedClient::Audit
17
+ # Request body for ``POST /api/v1/search/events``. Mirrors every column filter accepted by ``GET /api/v1/events`` with identical semantics, and adds a top-level ``filter`` field carrying a JSON Logic expression. When ``filter`` is present the search is silently capped to the last 30 days by ``occurred_at``; the expression is then evaluated in memory against each row that passes the column filters using the same ``json-logic-qubit`` evaluator that runs in the forwarder pipeline (so search results match what would be forwarded). Filter-combination rules match ``GET /api/v1/events`` exactly: - ``filter[resource_id]`` must be accompanied by ``filter[resource_type]`` — the index is keyed on the pair. - ``filter[search]`` must be accompanied by either ``filter[occurred_at]`` or ``filter[resource_type]`` + ``filter[resource_id]`` — substring matching has no index, so an unbounded substring scan is rejected.
18
+ class SearchEventsRequest < ApiModelBase
19
+ # The HTTP request as it was sent to the destination. Header values are redacted.
20
+ attr_accessor :filter
21
+
22
+ # Exact match on the event's `action` field.
23
+ attr_accessor :filter_action
24
+
25
+ # Exact match on the event's `resource_type` field.
26
+ attr_accessor :filter_resource_type
27
+
28
+ # Exact match on the event's `resource_id` field. Must be accompanied by `filter[resource_type]`.
29
+ attr_accessor :filter_resource_id
30
+
31
+ # Exact match on the event's `actor_type` field.
32
+ attr_accessor :filter_actor_type
33
+
34
+ # Exact match on the event's `actor_id` field.
35
+ attr_accessor :filter_actor_id
36
+
37
+ # Date range using interval notation, e.g. `[2026-04-01T00:00:00Z,2026-04-15T00:00:00Z)`. Required by `filter[search]` when the resource pair isn't provided. When a JSON Logic `filter` is present, the effective range is intersected with the last 30 days.
38
+ attr_accessor :filter_occurred_at
39
+
40
+ # Case-insensitive substring match on `resource_id` or `description`. Must be accompanied by either `filter[occurred_at]` or `filter[resource_type]` + `filter[resource_id]`.
41
+ attr_accessor :filter_search
42
+
43
+ # Maximum events to return. Range 1..1000, default 10. The default is intentionally smaller than the list endpoint's default of 1000 because the search UI typically renders results one card at a time.
44
+ attr_accessor :page_size
45
+
46
+ # Opaque cursor — pass the previous response's `links.next` cursor verbatim to fetch the next page. Keep the same `sort` value across paginated requests.
47
+ attr_accessor :page_after
48
+
49
+ # Sort field: `occurred_at` or `created_at`, optionally prefixed with `-` for descending order. Default `-occurred_at` (newest first).
50
+ attr_accessor :sort
51
+
52
+ # Attribute mapping from ruby-style variable name to JSON key.
53
+ def self.attribute_map
54
+ {
55
+ :'filter' => :'filter',
56
+ :'filter_action' => :'filter[action]',
57
+ :'filter_resource_type' => :'filter[resource_type]',
58
+ :'filter_resource_id' => :'filter[resource_id]',
59
+ :'filter_actor_type' => :'filter[actor_type]',
60
+ :'filter_actor_id' => :'filter[actor_id]',
61
+ :'filter_occurred_at' => :'filter[occurred_at]',
62
+ :'filter_search' => :'filter[search]',
63
+ :'page_size' => :'page[size]',
64
+ :'page_after' => :'page[after]',
65
+ :'sort' => :'sort'
66
+ }
67
+ end
68
+
69
+ # Returns attribute mapping this model knows about
70
+ def self.acceptable_attribute_map
71
+ attribute_map
72
+ end
73
+
74
+ # Returns all the JSON keys this model knows about
75
+ def self.acceptable_attributes
76
+ acceptable_attribute_map.values
77
+ end
78
+
79
+ # Attribute type mapping.
80
+ def self.openapi_types
81
+ {
82
+ :'filter' => :'Hash<String, Object>',
83
+ :'filter_action' => :'String',
84
+ :'filter_resource_type' => :'String',
85
+ :'filter_resource_id' => :'String',
86
+ :'filter_actor_type' => :'String',
87
+ :'filter_actor_id' => :'String',
88
+ :'filter_occurred_at' => :'String',
89
+ :'filter_search' => :'String',
90
+ :'page_size' => :'Integer',
91
+ :'page_after' => :'String',
92
+ :'sort' => :'String'
93
+ }
94
+ end
95
+
96
+ # List of attributes with nullable: true
97
+ def self.openapi_nullable
98
+ Set.new([
99
+ :'filter',
100
+ :'filter_action',
101
+ :'filter_resource_type',
102
+ :'filter_resource_id',
103
+ :'filter_actor_type',
104
+ :'filter_actor_id',
105
+ :'filter_occurred_at',
106
+ :'filter_search',
107
+ :'page_after',
108
+ ])
109
+ end
110
+
111
+ # Initializes the object
112
+ # @param [Hash] attributes Model attributes in the form of hash
113
+ def initialize(attributes = {})
114
+ if (!attributes.is_a?(Hash))
115
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::Audit::SearchEventsRequest` initialize method"
116
+ end
117
+
118
+ # check to see if the attribute exists and convert string to symbol for hash key
119
+ acceptable_attribute_map = self.class.acceptable_attribute_map
120
+ attributes = attributes.each_with_object({}) { |(k, v), h|
121
+ if (!acceptable_attribute_map.key?(k.to_sym))
122
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::Audit::SearchEventsRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
123
+ end
124
+ h[k.to_sym] = v
125
+ }
126
+
127
+ if attributes.key?(:'filter')
128
+ if (value = attributes[:'filter']).is_a?(Hash)
129
+ self.filter = value
130
+ end
131
+ end
132
+
133
+ if attributes.key?(:'filter_action')
134
+ self.filter_action = attributes[:'filter_action']
135
+ end
136
+
137
+ if attributes.key?(:'filter_resource_type')
138
+ self.filter_resource_type = attributes[:'filter_resource_type']
139
+ end
140
+
141
+ if attributes.key?(:'filter_resource_id')
142
+ self.filter_resource_id = attributes[:'filter_resource_id']
143
+ end
144
+
145
+ if attributes.key?(:'filter_actor_type')
146
+ self.filter_actor_type = attributes[:'filter_actor_type']
147
+ end
148
+
149
+ if attributes.key?(:'filter_actor_id')
150
+ self.filter_actor_id = attributes[:'filter_actor_id']
151
+ end
152
+
153
+ if attributes.key?(:'filter_occurred_at')
154
+ self.filter_occurred_at = attributes[:'filter_occurred_at']
155
+ end
156
+
157
+ if attributes.key?(:'filter_search')
158
+ self.filter_search = attributes[:'filter_search']
159
+ end
160
+
161
+ if attributes.key?(:'page_size')
162
+ self.page_size = attributes[:'page_size']
163
+ else
164
+ self.page_size = 10
165
+ end
166
+
167
+ if attributes.key?(:'page_after')
168
+ self.page_after = attributes[:'page_after']
169
+ end
170
+
171
+ if attributes.key?(:'sort')
172
+ self.sort = attributes[:'sort']
173
+ else
174
+ self.sort = '-occurred_at'
175
+ end
176
+ end
177
+
178
+ # Show invalid properties with the reasons. Usually used together with valid?
179
+ # @return Array for valid properties with the reasons
180
+ def list_invalid_properties
181
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
182
+ invalid_properties = Array.new
183
+ if !@page_size.nil? && @page_size > 1000
184
+ invalid_properties.push('invalid value for "page_size", must be smaller than or equal to 1000.')
185
+ end
186
+
187
+ if !@page_size.nil? && @page_size < 1
188
+ invalid_properties.push('invalid value for "page_size", must be greater than or equal to 1.')
189
+ end
190
+
191
+ invalid_properties
192
+ end
193
+
194
+ # Check to see if the all the properties in the model are valid
195
+ # @return true if the model is valid
196
+ def valid?
197
+ warn '[DEPRECATED] the `valid?` method is obsolete'
198
+ return false if !@page_size.nil? && @page_size > 1000
199
+ return false if !@page_size.nil? && @page_size < 1
200
+ true
201
+ end
202
+
203
+ # Custom attribute writer method with validation
204
+ # @param [Object] page_size Value to be assigned
205
+ def page_size=(page_size)
206
+ if page_size.nil?
207
+ fail ArgumentError, 'page_size cannot be nil'
208
+ end
209
+
210
+ if page_size > 1000
211
+ fail ArgumentError, 'invalid value for "page_size", must be smaller than or equal to 1000.'
212
+ end
213
+
214
+ if page_size < 1
215
+ fail ArgumentError, 'invalid value for "page_size", must be greater than or equal to 1.'
216
+ end
217
+
218
+ @page_size = page_size
219
+ end
220
+
221
+ # Checks equality by comparing each attribute.
222
+ # @param [Object] Object to be compared
223
+ def ==(o)
224
+ return true if self.equal?(o)
225
+ self.class == o.class &&
226
+ filter == o.filter &&
227
+ filter_action == o.filter_action &&
228
+ filter_resource_type == o.filter_resource_type &&
229
+ filter_resource_id == o.filter_resource_id &&
230
+ filter_actor_type == o.filter_actor_type &&
231
+ filter_actor_id == o.filter_actor_id &&
232
+ filter_occurred_at == o.filter_occurred_at &&
233
+ filter_search == o.filter_search &&
234
+ page_size == o.page_size &&
235
+ page_after == o.page_after &&
236
+ sort == o.sort
237
+ end
238
+
239
+ # @see the `==` method
240
+ # @param [Object] Object to be compared
241
+ def eql?(o)
242
+ self == o
243
+ end
244
+
245
+ # Calculates hash code according to all attributes.
246
+ # @return [Integer] Hash code
247
+ def hash
248
+ [filter, filter_action, filter_resource_type, filter_resource_id, filter_actor_type, filter_actor_id, filter_occurred_at, filter_search, page_size, page_after, sort].hash
249
+ end
250
+
251
+ # Builds the object from hash
252
+ # @param [Hash] attributes Model attributes in the form of hash
253
+ # @return [Object] Returns the model itself
254
+ def self.build_from_hash(attributes)
255
+ return nil unless attributes.is_a?(Hash)
256
+ attributes = attributes.transform_keys(&:to_sym)
257
+ transformed_hash = {}
258
+ openapi_types.each_pair do |key, type|
259
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
260
+ transformed_hash["#{key}"] = nil
261
+ elsif type =~ /\AArray<(.*)>/i
262
+ # check to ensure the input is an array given that the attribute
263
+ # is documented as an array but the input is not
264
+ if attributes[attribute_map[key]].is_a?(Array)
265
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
266
+ end
267
+ elsif !attributes[attribute_map[key]].nil?
268
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
269
+ end
270
+ end
271
+ new(transformed_hash)
272
+ end
273
+
274
+ # Returns the object in the form of hash
275
+ # @return [Hash] Returns the object in the form of hash
276
+ def to_hash
277
+ hash = {}
278
+ self.class.attribute_map.each_pair do |attr, param|
279
+ value = self.send(attr)
280
+ if value.nil?
281
+ is_nullable = self.class.openapi_nullable.include?(attr)
282
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
283
+ end
284
+
285
+ hash[param] = _to_hash(value)
286
+ end
287
+ hash
288
+ end
289
+
290
+ end
291
+
292
+ end
@@ -0,0 +1,203 @@
1
+ =begin
2
+ #smplkit Audit API
3
+
4
+ #Append-only change-history substrate for smpl.* resources and customer-application events. ADR-047.
5
+
6
+ The version of the OpenAPI document: 0.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module SmplkitGeneratedClient::Audit
17
+ # JSON:API list envelope returned by the search endpoint. Structurally identical to ``EventListResponse`` from the list endpoint — the only difference is the extra `scan` block inside `meta` (`SearchEventsListMeta` vs `EventListMeta`).
18
+ class SearchEventsResponse < ApiModelBase
19
+ attr_accessor :data
20
+
21
+ attr_accessor :meta
22
+
23
+ attr_accessor :links
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'data' => :'data',
29
+ :'meta' => :'meta',
30
+ :'links' => :'links'
31
+ }
32
+ end
33
+
34
+ # Returns attribute mapping this model knows about
35
+ def self.acceptable_attribute_map
36
+ attribute_map
37
+ end
38
+
39
+ # Returns all the JSON keys this model knows about
40
+ def self.acceptable_attributes
41
+ acceptable_attribute_map.values
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.openapi_types
46
+ {
47
+ :'data' => :'Array<EventResource>',
48
+ :'meta' => :'SearchEventsListMeta',
49
+ :'links' => :'SearchEventsListLinks'
50
+ }
51
+ end
52
+
53
+ # List of attributes with nullable: true
54
+ def self.openapi_nullable
55
+ Set.new([
56
+ :'links'
57
+ ])
58
+ end
59
+
60
+ # Initializes the object
61
+ # @param [Hash] attributes Model attributes in the form of hash
62
+ def initialize(attributes = {})
63
+ if (!attributes.is_a?(Hash))
64
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::Audit::SearchEventsResponse` initialize method"
65
+ end
66
+
67
+ # check to see if the attribute exists and convert string to symbol for hash key
68
+ acceptable_attribute_map = self.class.acceptable_attribute_map
69
+ attributes = attributes.each_with_object({}) { |(k, v), h|
70
+ if (!acceptable_attribute_map.key?(k.to_sym))
71
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::Audit::SearchEventsResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
72
+ end
73
+ h[k.to_sym] = v
74
+ }
75
+
76
+ if attributes.key?(:'data')
77
+ if (value = attributes[:'data']).is_a?(Array)
78
+ self.data = value
79
+ end
80
+ else
81
+ self.data = nil
82
+ end
83
+
84
+ if attributes.key?(:'meta')
85
+ self.meta = attributes[:'meta']
86
+ else
87
+ self.meta = nil
88
+ end
89
+
90
+ if attributes.key?(:'links')
91
+ self.links = attributes[:'links']
92
+ end
93
+ end
94
+
95
+ # Show invalid properties with the reasons. Usually used together with valid?
96
+ # @return Array for valid properties with the reasons
97
+ def list_invalid_properties
98
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
99
+ invalid_properties = Array.new
100
+ if @data.nil?
101
+ invalid_properties.push('invalid value for "data", data cannot be nil.')
102
+ end
103
+
104
+ if @meta.nil?
105
+ invalid_properties.push('invalid value for "meta", meta cannot be nil.')
106
+ end
107
+
108
+ invalid_properties
109
+ end
110
+
111
+ # Check to see if the all the properties in the model are valid
112
+ # @return true if the model is valid
113
+ def valid?
114
+ warn '[DEPRECATED] the `valid?` method is obsolete'
115
+ return false if @data.nil?
116
+ return false if @meta.nil?
117
+ true
118
+ end
119
+
120
+ # Custom attribute writer method with validation
121
+ # @param [Object] data Value to be assigned
122
+ def data=(data)
123
+ if data.nil?
124
+ fail ArgumentError, 'data cannot be nil'
125
+ end
126
+
127
+ @data = data
128
+ end
129
+
130
+ # Custom attribute writer method with validation
131
+ # @param [Object] meta Value to be assigned
132
+ def meta=(meta)
133
+ if meta.nil?
134
+ fail ArgumentError, 'meta cannot be nil'
135
+ end
136
+
137
+ @meta = meta
138
+ end
139
+
140
+ # Checks equality by comparing each attribute.
141
+ # @param [Object] Object to be compared
142
+ def ==(o)
143
+ return true if self.equal?(o)
144
+ self.class == o.class &&
145
+ data == o.data &&
146
+ meta == o.meta &&
147
+ links == o.links
148
+ end
149
+
150
+ # @see the `==` method
151
+ # @param [Object] Object to be compared
152
+ def eql?(o)
153
+ self == o
154
+ end
155
+
156
+ # Calculates hash code according to all attributes.
157
+ # @return [Integer] Hash code
158
+ def hash
159
+ [data, meta, links].hash
160
+ end
161
+
162
+ # Builds the object from hash
163
+ # @param [Hash] attributes Model attributes in the form of hash
164
+ # @return [Object] Returns the model itself
165
+ def self.build_from_hash(attributes)
166
+ return nil unless attributes.is_a?(Hash)
167
+ attributes = attributes.transform_keys(&:to_sym)
168
+ transformed_hash = {}
169
+ openapi_types.each_pair do |key, type|
170
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
171
+ transformed_hash["#{key}"] = nil
172
+ elsif type =~ /\AArray<(.*)>/i
173
+ # check to ensure the input is an array given that the attribute
174
+ # is documented as an array but the input is not
175
+ if attributes[attribute_map[key]].is_a?(Array)
176
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
177
+ end
178
+ elsif !attributes[attribute_map[key]].nil?
179
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
180
+ end
181
+ end
182
+ new(transformed_hash)
183
+ end
184
+
185
+ # Returns the object in the form of hash
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_hash
188
+ hash = {}
189
+ self.class.attribute_map.each_pair do |attr, param|
190
+ value = self.send(attr)
191
+ if value.nil?
192
+ is_nullable = self.class.openapi_nullable.include?(attr)
193
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
194
+ end
195
+
196
+ hash[param] = _to_hash(value)
197
+ end
198
+ hash
199
+ end
200
+
201
+ end
202
+
203
+ end