mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-12-15 00:01:02 -05:00
improving sigs for new components
This commit is contained in:
parent
e19041aaad
commit
8ded86cec6
@ -4,6 +4,7 @@ module HTTPX
|
||||
def self.load_dependencies: (singleton(Session)) -> void
|
||||
def self.configure: (*untyped) -> void
|
||||
def self?.encode: (untyped) -> (Encoder | Transcoder::Form::Encoder)
|
||||
def self?.decode: (HTTPX::Response response) -> Transcoder::_Decoder
|
||||
|
||||
type multipart_value = string | Pathname | File | _Reader
|
||||
|
||||
@ -30,6 +31,37 @@ module HTTPX
|
||||
def read_from_part: (Integer? max_length) -> void
|
||||
end
|
||||
|
||||
class Decoder
|
||||
BOUNDARY_RE: Regexp
|
||||
|
||||
@state: :idle | :part_header | :part_body | :parse_boundary | :done
|
||||
@buffer: String
|
||||
@parts: Hash[String, untyped]
|
||||
@boundary: String
|
||||
@intermediate_boundary: String
|
||||
|
||||
def call: (Response response, untyped) -> Hash[String, untyped]
|
||||
|
||||
private
|
||||
|
||||
def initialize: (Response response) -> void
|
||||
|
||||
def parse: () -> void
|
||||
|
||||
def get_filename: (String head) -> String?
|
||||
end
|
||||
|
||||
class FilePart # < SimpleDelegator
|
||||
attr_reader original_filename: String
|
||||
attr_reader content_type: String
|
||||
|
||||
# @file: Tempfile
|
||||
|
||||
# private
|
||||
|
||||
def initialize: (String filename, String content_type) -> void
|
||||
end
|
||||
|
||||
module Part
|
||||
def self?.call: (multipart_nested_value) -> ([_Reader, String, String?])
|
||||
end
|
||||
|
||||
@ -21,7 +21,7 @@ module HTTPX
|
||||
end
|
||||
|
||||
interface _Decoder
|
||||
def decode: (string) -> String
|
||||
def call: (Response response, untyped options) -> untyped
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -7,6 +7,7 @@ module HTTPX::Transcoder
|
||||
|
||||
module Form
|
||||
def self?.encode: (urlencoded_input form) -> Encoder
|
||||
def self?.decode: (HTTPX::Response response) -> _Decoder
|
||||
|
||||
class Encoder
|
||||
extend Forwardable
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
module HTTPX::Transcoder
|
||||
module JSON
|
||||
def self?.encode: (_ToJson json) -> Encoder
|
||||
def self?.decode: (HTTPX::Response response) -> _Decoder
|
||||
|
||||
class Encoder
|
||||
extend Forwardable
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user