Class: A2A::Protocol::Protobuf::Operation

Inherits:
Object
  • Object
show all
Defined in:
lib/a2a/protocol/protobuf.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, request_type:, response_type:, server_streaming:, http_bindings:) ⇒ Operation

Returns a new instance of Operation.



35
36
37
38
39
40
41
42
# File 'lib/a2a/protocol/protobuf.rb', line 35

def initialize(name:, request_type:, response_type:,
               server_streaming:, http_bindings:)
  @name             = name
  @request_type     = request_type
  @response_type    = response_type
  @server_streaming = server_streaming
  @http_bindings    = http_bindings
end

Instance Attribute Details

#http_bindingsObject (readonly)

Returns the value of attribute http_bindings.



32
33
34
# File 'lib/a2a/protocol/protobuf.rb', line 32

def http_bindings
  @http_bindings
end

#nameObject (readonly)

Returns the value of attribute name.



32
33
34
# File 'lib/a2a/protocol/protobuf.rb', line 32

def name
  @name
end

#request_typeObject (readonly)

Returns the value of attribute request_type.



32
33
34
# File 'lib/a2a/protocol/protobuf.rb', line 32

def request_type
  @request_type
end

#response_typeObject (readonly)

Returns the value of attribute response_type.



32
33
34
# File 'lib/a2a/protocol/protobuf.rb', line 32

def response_type
  @response_type
end

#server_streamingObject (readonly)

Returns the value of attribute server_streaming.



32
33
34
# File 'lib/a2a/protocol/protobuf.rb', line 32

def server_streaming
  @server_streaming
end

Instance Method Details

#grpc_methodObject



62
# File 'lib/a2a/protocol/protobuf.rb', line 62

def grpc_method     = name

#inspectObject



68
69
70
# File 'lib/a2a/protocol/protobuf.rb', line 68

def inspect
  "#<Proto::Operation #{name} #{rest_verb.upcase} #{rest_path}>"
end

#json_rpc_methodObject

JSON-RPC and gRPC method names are identical to the RPC name.



61
# File 'lib/a2a/protocol/protobuf.rb', line 61

def json_rpc_method = name

#request_schemaObject

Bridge to Schema: convert proto PascalCase type name to the JSON schema title used by A2A::Protocol::JsonSchema.

"SendMessageRequest" => Schema["Send Message Request"]


51
52
53
# File 'lib/a2a/protocol/protobuf.rb', line 51

def request_schema
  A2A::Protocol::JsonSchema[pascal_to_title(request_type)]
end

#response_schemaObject



55
56
57
58
# File 'lib/a2a/protocol/protobuf.rb', line 55

def response_schema
  return nil if response_type.include?(".")  # google.protobuf.Empty
  A2A::Protocol::JsonSchema[pascal_to_title(response_type)]
end

#rest_pathObject



66
# File 'lib/a2a/protocol/protobuf.rb', line 66

def rest_path = http_bindings.first.path

#rest_verbObject

REST binding from the primary (non-tenant) HTTP annotation.



65
# File 'lib/a2a/protocol/protobuf.rb', line 65

def rest_verb = http_bindings.first.verb

#server_streaming?Boolean

Returns:

  • (Boolean)


44
# File 'lib/a2a/protocol/protobuf.rb', line 44

def server_streaming? = @server_streaming