mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-10-06 00:02:08 -04:00
66 lines
1.9 KiB
Plaintext
66 lines
1.9 KiB
Plaintext
module HTTPX
|
|
class GRPCError < Error
|
|
attr_reader status: Integer
|
|
attr_reader details: String
|
|
attr_reader metadata: headers
|
|
end
|
|
|
|
module Plugins
|
|
module GRPC
|
|
DEADLINE: Integer
|
|
MARSHAL_METHOD: Symbol
|
|
UNMARSHAL_METHOD: Symbol
|
|
HEADERS: Hash[String, String]
|
|
|
|
type compression_option = bool | String
|
|
type rpc_def = [String, untyped, untyped, Hash[Symbol, untyped]]
|
|
|
|
type grpc_message = String | _Each[String]
|
|
|
|
type grpc_request = untyped | _Each[untyped]
|
|
type grpc_response = untyped | _Each[untyped]
|
|
|
|
type credentials = Proc
|
|
|
|
interface _GRPCOptions
|
|
def grpc_service: () -> String?
|
|
|
|
def grpc_compression: () -> compression_option?
|
|
|
|
def grpc_rpcs: () -> Hash[String, rpc_def]?
|
|
|
|
def grpc_deadline: () -> Integer?
|
|
|
|
def call_credentials: () -> credentials?
|
|
end
|
|
|
|
def self.extra_options: (Options) -> (Options & _GRPCOptions)
|
|
def self.load_dependencies: (singleton(Session)) -> void
|
|
|
|
module ResponseMethods
|
|
attr_reader trailing_metadata: Hash[String, untyped]
|
|
|
|
def encoders: () -> Array[String | Encoding]
|
|
end
|
|
|
|
module InstanceMethods
|
|
def with_channel_credentials: (String ca_path, ?String? key, ?String? cert, **untyped) -> instance
|
|
|
|
def rpc: (_ToS rpc_name, untyped input, untyped output, **untyped) -> instance
|
|
|
|
def build_stub: (string origin, ?service: _ToS, ?compression: compression_option) -> instance
|
|
|
|
def execute: (_ToS rpc_method, grpc_message input, ?deadline: Integer, ?metadata: headers_input, **untyped) -> Call
|
|
|
|
private
|
|
|
|
def rpc_execute: (_ToS rpc_method, grpc_request input, **untyped) -> Call
|
|
|
|
def build_grpc_request: (string rpc_method, grpc_message input, ?deadline: Integer, ?metadata?: headers_input, **untyped) -> Request
|
|
end
|
|
end
|
|
|
|
type grpcSession = Session & GRPC::InstanceMethods
|
|
end
|
|
end
|