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



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
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
# File 'lib/agentcat-api/models/publish_event_request.rb', line 211

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?(:'input_tokens')
    self.input_tokens = attributes[:'input_tokens']
  end

  if attributes.key?(:'output_tokens')
    self.output_tokens = attributes[:'output_tokens']
  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_id ⇒ Object

Optional actor ID



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

def actor_id
  @actor_id
end

#agentcat_version ⇒ Object

Version of AgentCat being used



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

def agentcat_version
  @agentcat_version
end

#client_name ⇒ Object

Name of the MCP client



97
98
99
# File 'lib/agentcat-api/models/publish_event_request.rb', line 97

def client_name
  @client_name
end

#client_version ⇒ Object

Version of the MCP client



100
101
102
# File 'lib/agentcat-api/models/publish_event_request.rb', line 100

def client_version
  @client_version
end

#duration ⇒ Object

Duration of the operation in milliseconds



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

def duration
  @duration
end

#error ⇒ Object

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_id ⇒ Object

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_type ⇒ Object

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

#id ⇒ Object

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_id ⇒ Object

Actor ID for agentcat:identify events



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

def identify_actor_given_id
  @identify_actor_given_id
end

#identify_actor_name ⇒ Object

Actor name for agentcat:identify events



70
71
72
# File 'lib/agentcat-api/models/publish_event_request.rb', line 70

def identify_actor_name
  @identify_actor_name
end

#identify_data ⇒ Object

Additional data for agentcat:identify events



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

def identify_data
  @identify_data
end

#input_tokens ⇒ Object

Token count of the request side as measured by the SDK. When absent, the server estimates it from the stored parameters.



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

def input_tokens
  @input_tokens
end

#ip_address ⇒ Object

IP address of the client



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

def ip_address
  @ip_address
end

#is_error ⇒ Object

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

#output_tokens ⇒ Object

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
53
54
# File 'lib/agentcat-api/models/publish_event_request.rb', line 52

def output_tokens
  @output_tokens
end

#parameters ⇒ Object

Parameters sent with the request



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

def parameters
  @parameters
end

#project_id ⇒ Object

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

#properties ⇒ Object

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



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

def properties
  @properties
end

#resource_name ⇒ Object

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

#response ⇒ Object

Response data from the operation



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

def response
  @response
end

#sdk_language ⇒ Object

Programming language of the SDK used



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

def sdk_language
  @sdk_language
end

#server_name ⇒ Object

Name of the MCP server



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

def server_name
  @server_name
end

#server_version ⇒ Object

Version of the MCP server



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

def server_version
  @server_version
end

#session_id ⇒ Object

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

#tags ⇒ Object

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
77
78
# File 'lib/agentcat-api/models/publish_event_request.rb', line 76

def tags
  @tags
end

#timestamp ⇒ Object

Agent-provided timestamp of when the event occurred



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

def timestamp
  @timestamp
end

#user_intent ⇒ Object

Captured explanation of why the actor made this request



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

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



458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
# File 'lib/agentcat-api/models/publish_event_request.rb', line 458

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_map ⇒ Object

Returns attribute mapping this model knows about



159
160
161
# File 'lib/agentcat-api/models/publish_event_request.rb', line 159

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributes ⇒ Object

Returns all the JSON keys this model knows about



164
165
166
# File 'lib/agentcat-api/models/publish_event_request.rb', line 164

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_map ⇒ Object

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



125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/agentcat-api/models/publish_event_request.rb', line 125

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',
    :'input_tokens' => :'input_tokens',
    :'output_tokens' => :'output_tokens',
    :'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



434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
# File 'lib/agentcat-api/models/publish_event_request.rb', line 434

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_nullable ⇒ Object

List of attributes with nullable: true



203
204
205
206
207
# File 'lib/agentcat-api/models/publish_event_request.rb', line 203

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

.openapi_types ⇒ Object

Attribute type mapping.



169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# File 'lib/agentcat-api/models/publish_event_request.rb', line 169

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',
    :'input_tokens' => :'Integer',
    :'output_tokens' => :'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



386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
# File 'lib/agentcat-api/models/publish_event_request.rb', line 386

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 &&
      input_tokens == o.input_tokens &&
      output_tokens == o.output_tokens &&
      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



529
530
531
532
533
534
535
536
537
538
539
540
541
# File 'lib/agentcat-api/models/publish_event_request.rb', line 529

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


421
422
423
# File 'lib/agentcat-api/models/publish_event_request.rb', line 421

def eql?(o)
  self == o
end

#hash ⇒ Integer

Calculates hash code according to all attributes.

Returns:

  • (Integer) —

    Hash code



427
428
429
# File 'lib/agentcat-api/models/publish_event_request.rb', line 427

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

#list_invalid_properties ⇒ Object

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

Returns:

  • Array for valid properties with the reasons



344
345
346
347
348
349
350
351
352
# File 'lib/agentcat-api/models/publish_event_request.rb', line 344

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_body ⇒ Hash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash) —

    Returns the object in the form of hash



505
506
507
# File 'lib/agentcat-api/models/publish_event_request.rb', line 505

def to_body
  to_hash
end

#to_hash ⇒ Hash

Returns the object in the form of hash

Returns:

  • (Hash) —

    Returns the object in the form of hash



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

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_s ⇒ String

Returns the string representation of the object

Returns:

  • (String) —

    String presentation of the object



499
500
501
# File 'lib/agentcat-api/models/publish_event_request.rb', line 499

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



356
357
358
359
360
361
362
# File 'lib/agentcat-api/models/publish_event_request.rb', line 356

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