agentcat-api 0.0.1 → 0.0.3

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.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +9 -0
  3. data/README.md +101 -16
  4. data/Rakefile +10 -0
  5. data/agentcat-api.gemspec +40 -33
  6. data/docs/AlertsApi.md +141 -0
  7. data/docs/EmailChannelVerifyRequest.md +18 -0
  8. data/docs/EmailChannelVerifyResponse.md +20 -0
  9. data/docs/Error.md +18 -0
  10. data/docs/EventAcceptedResponse.md +18 -0
  11. data/docs/EventsApi.md +81 -0
  12. data/docs/NotificationsApi.md +143 -0
  13. data/docs/PublishEventRequest.md +72 -0
  14. data/docs/QueryTimeout.md +20 -0
  15. data/docs/UnsubscribeRequestRequest.md +18 -0
  16. data/docs/ValidationErrorValue.md +49 -0
  17. data/lib/agentcat-api/api/alerts_api.rb +142 -0
  18. data/lib/agentcat-api/api/events_api.rb +86 -0
  19. data/lib/agentcat-api/api/notifications_api.rb +154 -0
  20. data/lib/agentcat-api/api_client.rb +437 -0
  21. data/lib/agentcat-api/api_error.rb +58 -0
  22. data/lib/agentcat-api/configuration.rb +392 -0
  23. data/lib/agentcat-api/models/email_channel_verify_request.rb +239 -0
  24. data/lib/agentcat-api/models/email_channel_verify_response.rb +263 -0
  25. data/lib/agentcat-api/models/error.rb +237 -0
  26. data/lib/agentcat-api/models/event_accepted_response.rb +222 -0
  27. data/lib/agentcat-api/models/publish_event_request.rb +545 -0
  28. data/lib/agentcat-api/models/query_timeout.rb +287 -0
  29. data/lib/agentcat-api/models/unsubscribe_request_request.rb +239 -0
  30. data/lib/agentcat-api/models/validation_error_value.rb +105 -0
  31. data/lib/agentcat-api/version.rb +15 -0
  32. data/lib/agentcat-api.rb +50 -0
  33. data/spec/api/alerts_api_spec.rb +59 -0
  34. data/spec/api/events_api_spec.rb +47 -0
  35. data/spec/api/notifications_api_spec.rb +60 -0
  36. data/spec/models/email_channel_verify_request_spec.rb +36 -0
  37. data/spec/models/email_channel_verify_response_spec.rb +42 -0
  38. data/spec/models/error_spec.rb +36 -0
  39. data/spec/models/event_accepted_response_spec.rb +36 -0
  40. data/spec/models/publish_event_request_spec.rb +202 -0
  41. data/spec/models/query_timeout_spec.rb +46 -0
  42. data/spec/models/unsubscribe_request_request_spec.rb +36 -0
  43. data/spec/models/validation_error_value_spec.rb +32 -0
  44. data/spec/spec_helper.rb +111 -0
  45. metadata +135 -23
  46. data/LICENSE +0 -21
  47. data/lib/agentcat/api/version.rb +0 -7
  48. data/lib/agentcat/api.rb +0 -30
@@ -0,0 +1,545 @@
1
+ =begin
2
+ #AgentCat API
3
+
4
+ #API for AgentCat application
5
+
6
+ The version of the OpenAPI document: v1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.14.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module AgentCatApi
17
+ class PublishEventRequest
18
+ # ID of the event, typically auto-generated by the AgentCat Agent
19
+ attr_accessor :id
20
+
21
+ # ID of the project this event belongs to
22
+ attr_accessor :project_id
23
+
24
+ # ID of the session this event belongs to. Null for stateless mode (server assigns session).
25
+ attr_accessor :session_id
26
+
27
+ # Optional actor ID
28
+ attr_accessor :actor_id
29
+
30
+ # Optional custom event ID (must be unique)
31
+ attr_accessor :event_id
32
+
33
+ # Type of event (e.g., mcp:tools/call, agentcat:identify)
34
+ attr_accessor :event_type
35
+
36
+ # Whether this event represents an error
37
+ attr_accessor :is_error
38
+
39
+ # Error details if is_error is true
40
+ attr_accessor :error
41
+
42
+ # Name of the resource accessed (for resource events)
43
+ attr_accessor :resource_name
44
+
45
+ # Duration of the operation in milliseconds
46
+ attr_accessor :duration
47
+
48
+ # Token count of the request side as measured by the SDK. When absent, the server estimates it from the stored parameters.
49
+ attr_accessor :input_tokens
50
+
51
+ # Token count of the response side as measured by the SDK. When absent, the server estimates it from the stored response. Drives the oversized-tool-response rule.
52
+ attr_accessor :output_tokens
53
+
54
+ # Agent-provided timestamp of when the event occurred
55
+ attr_accessor :timestamp
56
+
57
+ # Captured explanation of why the actor made this request
58
+ attr_accessor :user_intent
59
+
60
+ # Parameters sent with the request
61
+ attr_accessor :parameters
62
+
63
+ # Response data from the operation
64
+ attr_accessor :response
65
+
66
+ # Actor ID for agentcat:identify events
67
+ attr_accessor :identify_actor_given_id
68
+
69
+ # Actor name for agentcat:identify events
70
+ attr_accessor :identify_actor_name
71
+
72
+ # Additional data for agentcat:identify events
73
+ attr_accessor :identify_data
74
+
75
+ # Custom string key-value pairs. Keys: max 32 chars, alphanumeric/underscore/period/colon/dash/dollar-sign only. Values: max 200 chars, no newlines. Max 50 entries.
76
+ attr_accessor :tags
77
+
78
+ # Custom structured data. Keys are strings, values can be string, number, boolean, array, object, or null (null values are filtered out).
79
+ attr_accessor :properties
80
+
81
+ # IP address of the client
82
+ attr_accessor :ip_address
83
+
84
+ # Programming language of the SDK used
85
+ attr_accessor :sdk_language
86
+
87
+ # Version of AgentCat being used
88
+ attr_accessor :agentcat_version
89
+
90
+ # Name of the MCP server
91
+ attr_accessor :server_name
92
+
93
+ # Version of the MCP server
94
+ attr_accessor :server_version
95
+
96
+ # Name of the MCP client
97
+ attr_accessor :client_name
98
+
99
+ # Version of the MCP client
100
+ attr_accessor :client_version
101
+
102
+ class EnumAttributeValidator
103
+ attr_reader :datatype
104
+ attr_reader :allowable_values
105
+
106
+ def initialize(datatype, allowable_values)
107
+ @allowable_values = allowable_values.map do |value|
108
+ case datatype.to_s
109
+ when /Integer/i
110
+ value.to_i
111
+ when /Float/i
112
+ value.to_f
113
+ else
114
+ value
115
+ end
116
+ end
117
+ end
118
+
119
+ def valid?(value)
120
+ !value || allowable_values.include?(value)
121
+ end
122
+ end
123
+
124
+ # Attribute mapping from ruby-style variable name to JSON key.
125
+ def self.attribute_map
126
+ {
127
+ :'id' => :'id',
128
+ :'project_id' => :'project_id',
129
+ :'session_id' => :'session_id',
130
+ :'actor_id' => :'actor_id',
131
+ :'event_id' => :'event_id',
132
+ :'event_type' => :'event_type',
133
+ :'is_error' => :'is_error',
134
+ :'error' => :'error',
135
+ :'resource_name' => :'resource_name',
136
+ :'duration' => :'duration',
137
+ :'input_tokens' => :'input_tokens',
138
+ :'output_tokens' => :'output_tokens',
139
+ :'timestamp' => :'timestamp',
140
+ :'user_intent' => :'user_intent',
141
+ :'parameters' => :'parameters',
142
+ :'response' => :'response',
143
+ :'identify_actor_given_id' => :'identify_actor_given_id',
144
+ :'identify_actor_name' => :'identify_actor_name',
145
+ :'identify_data' => :'identify_data',
146
+ :'tags' => :'tags',
147
+ :'properties' => :'properties',
148
+ :'ip_address' => :'ip_address',
149
+ :'sdk_language' => :'sdk_language',
150
+ :'agentcat_version' => :'agentcat_version',
151
+ :'server_name' => :'server_name',
152
+ :'server_version' => :'server_version',
153
+ :'client_name' => :'client_name',
154
+ :'client_version' => :'client_version'
155
+ }
156
+ end
157
+
158
+ # Returns attribute mapping this model knows about
159
+ def self.acceptable_attribute_map
160
+ attribute_map
161
+ end
162
+
163
+ # Returns all the JSON keys this model knows about
164
+ def self.acceptable_attributes
165
+ acceptable_attribute_map.values
166
+ end
167
+
168
+ # Attribute type mapping.
169
+ def self.openapi_types
170
+ {
171
+ :'id' => :'String',
172
+ :'project_id' => :'String',
173
+ :'session_id' => :'String',
174
+ :'actor_id' => :'String',
175
+ :'event_id' => :'String',
176
+ :'event_type' => :'String',
177
+ :'is_error' => :'Boolean',
178
+ :'error' => :'Object',
179
+ :'resource_name' => :'String',
180
+ :'duration' => :'Integer',
181
+ :'input_tokens' => :'Integer',
182
+ :'output_tokens' => :'Integer',
183
+ :'timestamp' => :'Time',
184
+ :'user_intent' => :'String',
185
+ :'parameters' => :'Object',
186
+ :'response' => :'Object',
187
+ :'identify_actor_given_id' => :'String',
188
+ :'identify_actor_name' => :'String',
189
+ :'identify_data' => :'Object',
190
+ :'tags' => :'Hash<String, String>',
191
+ :'properties' => :'Object',
192
+ :'ip_address' => :'String',
193
+ :'sdk_language' => :'String',
194
+ :'agentcat_version' => :'String',
195
+ :'server_name' => :'String',
196
+ :'server_version' => :'String',
197
+ :'client_name' => :'String',
198
+ :'client_version' => :'String'
199
+ }
200
+ end
201
+
202
+ # List of attributes with nullable: true
203
+ def self.openapi_nullable
204
+ Set.new([
205
+ :'session_id',
206
+ ])
207
+ end
208
+
209
+ # Initializes the object
210
+ # @param [Hash] attributes Model attributes in the form of hash
211
+ def initialize(attributes = {})
212
+ if (!attributes.is_a?(Hash))
213
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AgentCatApi::PublishEventRequest` initialize method"
214
+ end
215
+
216
+ # check to see if the attribute exists and convert string to symbol for hash key
217
+ acceptable_attribute_map = self.class.acceptable_attribute_map
218
+ attributes = attributes.each_with_object({}) { |(k, v), h|
219
+ if (!acceptable_attribute_map.key?(k.to_sym))
220
+ fail ArgumentError, "`#{k}` is not a valid attribute in `AgentCatApi::PublishEventRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
221
+ end
222
+ h[k.to_sym] = v
223
+ }
224
+
225
+ if attributes.key?(:'id')
226
+ self.id = attributes[:'id']
227
+ end
228
+
229
+ if attributes.key?(:'project_id')
230
+ self.project_id = attributes[:'project_id']
231
+ else
232
+ self.project_id = nil
233
+ end
234
+
235
+ if attributes.key?(:'session_id')
236
+ self.session_id = attributes[:'session_id']
237
+ end
238
+
239
+ if attributes.key?(:'actor_id')
240
+ self.actor_id = attributes[:'actor_id']
241
+ end
242
+
243
+ if attributes.key?(:'event_id')
244
+ self.event_id = attributes[:'event_id']
245
+ end
246
+
247
+ if attributes.key?(:'event_type')
248
+ self.event_type = attributes[:'event_type']
249
+ end
250
+
251
+ if attributes.key?(:'is_error')
252
+ self.is_error = attributes[:'is_error']
253
+ end
254
+
255
+ if attributes.key?(:'error')
256
+ self.error = attributes[:'error']
257
+ end
258
+
259
+ if attributes.key?(:'resource_name')
260
+ self.resource_name = attributes[:'resource_name']
261
+ end
262
+
263
+ if attributes.key?(:'duration')
264
+ self.duration = attributes[:'duration']
265
+ end
266
+
267
+ if attributes.key?(:'input_tokens')
268
+ self.input_tokens = attributes[:'input_tokens']
269
+ end
270
+
271
+ if attributes.key?(:'output_tokens')
272
+ self.output_tokens = attributes[:'output_tokens']
273
+ end
274
+
275
+ if attributes.key?(:'timestamp')
276
+ self.timestamp = attributes[:'timestamp']
277
+ end
278
+
279
+ if attributes.key?(:'user_intent')
280
+ self.user_intent = attributes[:'user_intent']
281
+ end
282
+
283
+ if attributes.key?(:'parameters')
284
+ self.parameters = attributes[:'parameters']
285
+ end
286
+
287
+ if attributes.key?(:'response')
288
+ self.response = attributes[:'response']
289
+ end
290
+
291
+ if attributes.key?(:'identify_actor_given_id')
292
+ self.identify_actor_given_id = attributes[:'identify_actor_given_id']
293
+ end
294
+
295
+ if attributes.key?(:'identify_actor_name')
296
+ self.identify_actor_name = attributes[:'identify_actor_name']
297
+ end
298
+
299
+ if attributes.key?(:'identify_data')
300
+ self.identify_data = attributes[:'identify_data']
301
+ end
302
+
303
+ if attributes.key?(:'tags')
304
+ if (value = attributes[:'tags']).is_a?(Hash)
305
+ self.tags = value
306
+ end
307
+ end
308
+
309
+ if attributes.key?(:'properties')
310
+ self.properties = attributes[:'properties']
311
+ end
312
+
313
+ if attributes.key?(:'ip_address')
314
+ self.ip_address = attributes[:'ip_address']
315
+ end
316
+
317
+ if attributes.key?(:'sdk_language')
318
+ self.sdk_language = attributes[:'sdk_language']
319
+ end
320
+
321
+ if attributes.key?(:'agentcat_version')
322
+ self.agentcat_version = attributes[:'agentcat_version']
323
+ end
324
+
325
+ if attributes.key?(:'server_name')
326
+ self.server_name = attributes[:'server_name']
327
+ end
328
+
329
+ if attributes.key?(:'server_version')
330
+ self.server_version = attributes[:'server_version']
331
+ end
332
+
333
+ if attributes.key?(:'client_name')
334
+ self.client_name = attributes[:'client_name']
335
+ end
336
+
337
+ if attributes.key?(:'client_version')
338
+ self.client_version = attributes[:'client_version']
339
+ end
340
+ end
341
+
342
+ # Show invalid properties with the reasons. Usually used together with valid?
343
+ # @return Array for valid properties with the reasons
344
+ def list_invalid_properties
345
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
346
+ invalid_properties = Array.new
347
+ if @project_id.nil?
348
+ invalid_properties.push('invalid value for "project_id", project_id cannot be nil.')
349
+ end
350
+
351
+ invalid_properties
352
+ end
353
+
354
+ # Check to see if the all the properties in the model are valid
355
+ # @return true if the model is valid
356
+ def valid?
357
+ warn '[DEPRECATED] the `valid?` method is obsolete'
358
+ return false if @project_id.nil?
359
+ event_type_validator = EnumAttributeValidator.new('String', ["mcp:ping", "mcp:initialize", "mcp:completion/complete", "mcp:logging/setLevel", "mcp:prompts/get", "mcp:prompts/list", "mcp:resources/list", "mcp:resources/templates/list", "mcp:resources/read", "mcp:resources/subscribe", "mcp:resources/unsubscribe", "mcp:tools/call", "mcp:tools/list", "mcp:tasks/get", "mcp:tasks/result", "mcp:tasks/list", "mcp:tasks/cancel", "agentcat:identify"])
360
+ return false unless event_type_validator.valid?(@event_type)
361
+ true
362
+ end
363
+
364
+ # Custom attribute writer method with validation
365
+ # @param [Object] project_id Value to be assigned
366
+ def project_id=(project_id)
367
+ if project_id.nil?
368
+ fail ArgumentError, 'project_id cannot be nil'
369
+ end
370
+
371
+ @project_id = project_id
372
+ end
373
+
374
+ # Custom attribute writer method checking allowed values (enum).
375
+ # @param [Object] event_type Object to be assigned
376
+ def event_type=(event_type)
377
+ validator = EnumAttributeValidator.new('String', ["mcp:ping", "mcp:initialize", "mcp:completion/complete", "mcp:logging/setLevel", "mcp:prompts/get", "mcp:prompts/list", "mcp:resources/list", "mcp:resources/templates/list", "mcp:resources/read", "mcp:resources/subscribe", "mcp:resources/unsubscribe", "mcp:tools/call", "mcp:tools/list", "mcp:tasks/get", "mcp:tasks/result", "mcp:tasks/list", "mcp:tasks/cancel", "agentcat:identify"])
378
+ unless validator.valid?(event_type)
379
+ fail ArgumentError, "invalid value for \"event_type\", must be one of #{validator.allowable_values}."
380
+ end
381
+ @event_type = event_type
382
+ end
383
+
384
+ # Checks equality by comparing each attribute.
385
+ # @param [Object] Object to be compared
386
+ def ==(o)
387
+ return true if self.equal?(o)
388
+ self.class == o.class &&
389
+ id == o.id &&
390
+ project_id == o.project_id &&
391
+ session_id == o.session_id &&
392
+ actor_id == o.actor_id &&
393
+ event_id == o.event_id &&
394
+ event_type == o.event_type &&
395
+ is_error == o.is_error &&
396
+ error == o.error &&
397
+ resource_name == o.resource_name &&
398
+ duration == o.duration &&
399
+ input_tokens == o.input_tokens &&
400
+ output_tokens == o.output_tokens &&
401
+ timestamp == o.timestamp &&
402
+ user_intent == o.user_intent &&
403
+ parameters == o.parameters &&
404
+ response == o.response &&
405
+ identify_actor_given_id == o.identify_actor_given_id &&
406
+ identify_actor_name == o.identify_actor_name &&
407
+ identify_data == o.identify_data &&
408
+ tags == o.tags &&
409
+ properties == o.properties &&
410
+ ip_address == o.ip_address &&
411
+ sdk_language == o.sdk_language &&
412
+ agentcat_version == o.agentcat_version &&
413
+ server_name == o.server_name &&
414
+ server_version == o.server_version &&
415
+ client_name == o.client_name &&
416
+ client_version == o.client_version
417
+ end
418
+
419
+ # @see the `==` method
420
+ # @param [Object] Object to be compared
421
+ def eql?(o)
422
+ self == o
423
+ end
424
+
425
+ # Calculates hash code according to all attributes.
426
+ # @return [Integer] Hash code
427
+ def hash
428
+ [id, project_id, session_id, actor_id, event_id, event_type, is_error, error, resource_name, duration, input_tokens, output_tokens, timestamp, user_intent, parameters, response, identify_actor_given_id, identify_actor_name, identify_data, tags, properties, ip_address, sdk_language, agentcat_version, server_name, server_version, client_name, client_version].hash
429
+ end
430
+
431
+ # Builds the object from hash
432
+ # @param [Hash] attributes Model attributes in the form of hash
433
+ # @return [Object] Returns the model itself
434
+ def self.build_from_hash(attributes)
435
+ return nil unless attributes.is_a?(Hash)
436
+ attributes = attributes.transform_keys(&:to_sym)
437
+ transformed_hash = {}
438
+ openapi_types.each_pair do |key, type|
439
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
440
+ transformed_hash["#{key}"] = nil
441
+ elsif type =~ /\AArray<(.*)>/i
442
+ # check to ensure the input is an array given that the attribute
443
+ # is documented as an array but the input is not
444
+ if attributes[attribute_map[key]].is_a?(Array)
445
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
446
+ end
447
+ elsif !attributes[attribute_map[key]].nil?
448
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
449
+ end
450
+ end
451
+ new(transformed_hash)
452
+ end
453
+
454
+ # Deserializes the data based on type
455
+ # @param string type Data type
456
+ # @param string value Value to be deserialized
457
+ # @return [Object] Deserialized data
458
+ def self._deserialize(type, value)
459
+ case type.to_sym
460
+ when :Time
461
+ Time.parse(value)
462
+ when :Date
463
+ Date.parse(value)
464
+ when :String
465
+ value.to_s
466
+ when :Integer
467
+ value.to_i
468
+ when :Float
469
+ value.to_f
470
+ when :Boolean
471
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
472
+ true
473
+ else
474
+ false
475
+ end
476
+ when :Object
477
+ # generic object (usually a Hash), return directly
478
+ value
479
+ when /\AArray<(?<inner_type>.+)>\z/
480
+ inner_type = Regexp.last_match[:inner_type]
481
+ value.map { |v| _deserialize(inner_type, v) }
482
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
483
+ k_type = Regexp.last_match[:k_type]
484
+ v_type = Regexp.last_match[:v_type]
485
+ {}.tap do |hash|
486
+ value.each do |k, v|
487
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
488
+ end
489
+ end
490
+ else # model
491
+ # models (e.g. Pet) or oneOf
492
+ klass = AgentCatApi.const_get(type)
493
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
494
+ end
495
+ end
496
+
497
+ # Returns the string representation of the object
498
+ # @return [String] String presentation of the object
499
+ def to_s
500
+ to_hash.to_s
501
+ end
502
+
503
+ # to_body is an alias to to_hash (backward compatibility)
504
+ # @return [Hash] Returns the object in the form of hash
505
+ def to_body
506
+ to_hash
507
+ end
508
+
509
+ # Returns the object in the form of hash
510
+ # @return [Hash] Returns the object in the form of hash
511
+ def to_hash
512
+ hash = {}
513
+ self.class.attribute_map.each_pair do |attr, param|
514
+ value = self.send(attr)
515
+ if value.nil?
516
+ is_nullable = self.class.openapi_nullable.include?(attr)
517
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
518
+ end
519
+
520
+ hash[param] = _to_hash(value)
521
+ end
522
+ hash
523
+ end
524
+
525
+ # Outputs non-array value in the form of hash
526
+ # For object, use to_hash. Otherwise, just return the value
527
+ # @param [Object] value Any valid value
528
+ # @return [Hash] Returns the value in the form of hash
529
+ def _to_hash(value)
530
+ if value.is_a?(Array)
531
+ value.compact.map { |v| _to_hash(v) }
532
+ elsif value.is_a?(Hash)
533
+ {}.tap do |hash|
534
+ value.each { |k, v| hash[k] = _to_hash(v) }
535
+ end
536
+ elsif value.respond_to? :to_hash
537
+ value.to_hash
538
+ else
539
+ value
540
+ end
541
+ end
542
+
543
+ end
544
+
545
+ end