Class: AgentCatApi::PublishEventRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/agentcat-api/models/publish_event_request.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ PublishEventRequest

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
# File 'lib/agentcat-api/models/publish_event_request.rb', line 201

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `AgentCatApi::PublishEventRequest` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      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
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'id')
    self.id = attributes[:'id']
  end

  if attributes.key?(:'project_id')
    self.project_id = attributes[:'project_id']
  else
    self.project_id = nil
  end

  if attributes.key?(:'session_id')
    self.session_id = attributes[:'session_id']
  end

  if attributes.key?(:'actor_id')
    self.actor_id = attributes[:'actor_id']
  end

  if attributes.key?(:'event_id')
    self.event_id = attributes[:'event_id']
  end

  if attributes.key?(:'event_type')
    self.event_type = attributes[:'event_type']
  end

  if attributes.key?(:'is_error')
    self.is_error = attributes[:'is_error']
  end

  if attributes.key?(:'error')
    self.error = attributes[:'error']
  end

  if attributes.key?(:'resource_name')
    self.resource_name = attributes[:'resource_name']
  end

  if attributes.key?(:'duration')
    self.duration = attributes[:'duration']
  end

  if attributes.key?(:'timestamp')
    self.timestamp = attributes[:'timestamp']
  end

  if attributes.key?(:'user_intent')
    self.user_intent = attributes[:'user_intent']
  end

  if attributes.key?(:'parameters')
    self.parameters = attributes[:'parameters']
  end

  if attributes.key?(:'response')
    self.response = attributes[:'response']
  end

  if attributes.key?(:'identify_actor_given_id')
    self.identify_actor_given_id = attributes[:'identify_actor_given_id']
  end

  if attributes.key?(:'identify_actor_name')
    self.identify_actor_name = attributes[:'identify_actor_name']
  end

  if attributes.key?(:'identify_data')
    self.identify_data = attributes[:'identify_data']
  end

  if attributes.key?(:'tags')
    if (value = attributes[:'tags']).is_a?(Hash)
      self.tags = value
    end
  end

  if attributes.key?(:'properties')
    self.properties = attributes[:'properties']
  end

  if attributes.key?(:'ip_address')
    self.ip_address = attributes[:'ip_address']
  end

  if attributes.key?(:'sdk_language')
    self.sdk_language = attributes[:'sdk_language']
  end

  if attributes.key?(:'agentcat_version')
    self.agentcat_version = attributes[:'agentcat_version']
  end

  if attributes.key?(:'server_name')
    self.server_name = attributes[:'server_name']
  end

  if attributes.key?(:'server_version')
    self.server_version = attributes[:'server_version']
  end

  if attributes.key?(:'client_name')
    self.client_name = attributes[:'client_name']
  end

  if attributes.key?(:'client_version')
    self.client_version = attributes[:'client_version']
  end
end

Instance Attribute Details

#actor_idObject

Optional actor ID



28
29
30
# File 'lib/agentcat-api/models/publish_event_request.rb', line 28

def actor_id
  @actor_id
end

#agentcat_versionObject

Version of AgentCat being used



82
83
84
# File 'lib/agentcat-api/models/publish_event_request.rb', line 82

def agentcat_version
  @agentcat_version
end

#client_nameObject

Name of the MCP client



91
92
93
# File 'lib/agentcat-api/models/publish_event_request.rb', line 91

def client_name
  @client_name
end

#client_versionObject

Version of the MCP client



94
95
96
# File 'lib/agentcat-api/models/publish_event_request.rb', line 94

def client_version
  @client_version
end

#durationObject

Duration of the operation in milliseconds



46
47
48
# File 'lib/agentcat-api/models/publish_event_request.rb', line 46

def duration
  @duration
end

#errorObject

Error details if is_error is true



40
41
42
# File 'lib/agentcat-api/models/publish_event_request.rb', line 40

def error
  @error
end

#event_idObject

Optional custom event ID (must be unique)



31
32
33
# File 'lib/agentcat-api/models/publish_event_request.rb', line 31

def event_id
  @event_id
end

#event_typeObject

Type of event (e.g., mcp:tools/call, agentcat:identify)



34
35
36
# File 'lib/agentcat-api/models/publish_event_request.rb', line 34

def event_type
  @event_type
end

#idObject

ID of the event, typically auto-generated by the AgentCat Agent



19
20
21
# File 'lib/agentcat-api/models/publish_event_request.rb', line 19

def id
  @id
end

#identify_actor_given_idObject

Actor ID for agentcat:identify events



61
62
63
# File 'lib/agentcat-api/models/publish_event_request.rb', line 61

def identify_actor_given_id
  @identify_actor_given_id
end

#identify_actor_nameObject

Actor name for agentcat:identify events



64
65
66
# File 'lib/agentcat-api/models/publish_event_request.rb', line 64

def identify_actor_name
  @identify_actor_name
end

#identify_dataObject

Additional data for agentcat:identify events



67
68
69
# File 'lib/agentcat-api/models/publish_event_request.rb', line 67

def identify_data
  @identify_data
end

#ip_addressObject

IP address of the client



76
77
78
# File 'lib/agentcat-api/models/publish_event_request.rb', line 76

def ip_address
  @ip_address
end

#is_errorObject

Whether this event represents an error



37
38
39
# File 'lib/agentcat-api/models/publish_event_request.rb', line 37

def is_error
  @is_error
end

#parametersObject

Parameters sent with the request



55
56
57
# File 'lib/agentcat-api/models/publish_event_request.rb', line 55

def parameters
  @parameters
end

#project_idObject

ID of the project this event belongs to



22
23
24
# File 'lib/agentcat-api/models/publish_event_request.rb', line 22

def project_id
  @project_id
end

#propertiesObject

Custom structured data. Keys are strings, values can be string, number, boolean, array, object, or null (null values are filtered out).



73
74
75
# File 'lib/agentcat-api/models/publish_event_request.rb', line 73

def properties
  @properties
end

#resource_nameObject

Name of the resource accessed (for resource events)



43
44
45
# File 'lib/agentcat-api/models/publish_event_request.rb', line 43

def resource_name
  @resource_name
end

#responseObject

Response data from the operation



58
59
60
# File 'lib/agentcat-api/models/publish_event_request.rb', line 58

def response
  @response
end

#sdk_languageObject

Programming language of the SDK used



79
80
81
# File 'lib/agentcat-api/models/publish_event_request.rb', line 79

def sdk_language
  @sdk_language
end

#server_nameObject

Name of the MCP server



85
86
87
# File 'lib/agentcat-api/models/publish_event_request.rb', line 85

def server_name
  @server_name
end

#server_versionObject

Version of the MCP server



88
89
90
# File 'lib/agentcat-api/models/publish_event_request.rb', line 88

def server_version
  @server_version
end

#session_idObject

ID of the session this event belongs to. Null for stateless mode (server assigns session).



25
26
27
# File 'lib/agentcat-api/models/publish_event_request.rb', line 25

def session_id
  @session_id
end

#tagsObject

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
71
72
# File 'lib/agentcat-api/models/publish_event_request.rb', line 70

def tags
  @tags
end

#timestampObject

Agent-provided timestamp of when the event occurred



49
50
51
# File 'lib/agentcat-api/models/publish_event_request.rb', line 49

def timestamp
  @timestamp
end

#user_intentObject

Captured explanation of why the actor made this request



52
53
54
# File 'lib/agentcat-api/models/publish_event_request.rb', line 52

def user_intent
  @user_intent
end

Class Method Details

._deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
# File 'lib/agentcat-api/models/publish_event_request.rb', line 438

def self._deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = AgentCatApi.const_get(type)
    klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



151
152
153
# File 'lib/agentcat-api/models/publish_event_request.rb', line 151

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



156
157
158
# File 'lib/agentcat-api/models/publish_event_request.rb', line 156

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/agentcat-api/models/publish_event_request.rb', line 119

def self.attribute_map
  {
    :'id' => :'id',
    :'project_id' => :'project_id',
    :'session_id' => :'session_id',
    :'actor_id' => :'actor_id',
    :'event_id' => :'event_id',
    :'event_type' => :'event_type',
    :'is_error' => :'is_error',
    :'error' => :'error',
    :'resource_name' => :'resource_name',
    :'duration' => :'duration',
    :'timestamp' => :'timestamp',
    :'user_intent' => :'user_intent',
    :'parameters' => :'parameters',
    :'response' => :'response',
    :'identify_actor_given_id' => :'identify_actor_given_id',
    :'identify_actor_name' => :'identify_actor_name',
    :'identify_data' => :'identify_data',
    :'tags' => :'tags',
    :'properties' => :'properties',
    :'ip_address' => :'ip_address',
    :'sdk_language' => :'sdk_language',
    :'agentcat_version' => :'agentcat_version',
    :'server_name' => :'server_name',
    :'server_version' => :'server_version',
    :'client_name' => :'client_name',
    :'client_version' => :'client_version'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
# File 'lib/agentcat-api/models/publish_event_request.rb', line 414

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



193
194
195
196
197
# File 'lib/agentcat-api/models/publish_event_request.rb', line 193

def self.openapi_nullable
  Set.new([
    :'session_id',
  ])
end

.openapi_typesObject

Attribute type mapping.



161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# File 'lib/agentcat-api/models/publish_event_request.rb', line 161

def self.openapi_types
  {
    :'id' => :'String',
    :'project_id' => :'String',
    :'session_id' => :'String',
    :'actor_id' => :'String',
    :'event_id' => :'String',
    :'event_type' => :'String',
    :'is_error' => :'Boolean',
    :'error' => :'Object',
    :'resource_name' => :'String',
    :'duration' => :'Integer',
    :'timestamp' => :'Time',
    :'user_intent' => :'String',
    :'parameters' => :'Object',
    :'response' => :'Object',
    :'identify_actor_given_id' => :'String',
    :'identify_actor_name' => :'String',
    :'identify_data' => :'Object',
    :'tags' => :'Hash<String, String>',
    :'properties' => :'Object',
    :'ip_address' => :'String',
    :'sdk_language' => :'String',
    :'agentcat_version' => :'String',
    :'server_name' => :'String',
    :'server_version' => :'String',
    :'client_name' => :'String',
    :'client_version' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
# File 'lib/agentcat-api/models/publish_event_request.rb', line 368

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      project_id == o.project_id &&
      session_id == o.session_id &&
      actor_id == o.actor_id &&
      event_id == o.event_id &&
      event_type == o.event_type &&
      is_error == o.is_error &&
      error == o.error &&
      resource_name == o.resource_name &&
      duration == o.duration &&
      timestamp == o.timestamp &&
      user_intent == o.user_intent &&
      parameters == o.parameters &&
      response == o.response &&
      identify_actor_given_id == o.identify_actor_given_id &&
      identify_actor_name == o.identify_actor_name &&
      identify_data == o.identify_data &&
      tags == o.tags &&
      properties == o.properties &&
      ip_address == o.ip_address &&
      sdk_language == o.sdk_language &&
      agentcat_version == o.agentcat_version &&
      server_name == o.server_name &&
      server_version == o.server_version &&
      client_name == o.client_name &&
      client_version == o.client_version
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



509
510
511
512
513
514
515
516
517
518
519
520
521
# File 'lib/agentcat-api/models/publish_event_request.rb', line 509

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


401
402
403
# File 'lib/agentcat-api/models/publish_event_request.rb', line 401

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



407
408
409
# File 'lib/agentcat-api/models/publish_event_request.rb', line 407

def hash
  [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
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



326
327
328
329
330
331
332
333
334
# File 'lib/agentcat-api/models/publish_event_request.rb', line 326

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @project_id.nil?
    invalid_properties.push('invalid value for "project_id", project_id cannot be nil.')
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



485
486
487
# File 'lib/agentcat-api/models/publish_event_request.rb', line 485

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



491
492
493
494
495
496
497
498
499
500
501
502
503
# File 'lib/agentcat-api/models/publish_event_request.rb', line 491

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



479
480
481
# File 'lib/agentcat-api/models/publish_event_request.rb', line 479

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



338
339
340
341
342
343
344
# File 'lib/agentcat-api/models/publish_event_request.rb', line 338

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @project_id.nil?
  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"])
  return false unless event_type_validator.valid?(@event_type)
  true
end