agentcat-api 0.0.1 → 0.0.2

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