Vapor Documentation

Protocol Client

public protocol Client  

Default Implementations

logging(to:​)

public func logging(to logger: Logger) -> Client  

allocating(to:​)

public func allocating(to byteBufferAllocator: ByteBufferAllocator) -> Client  

byte​Buffer​Allocator

public var byteBufferAllocator: ByteBufferAllocator  

get(_:​headers:​before​Send:​)

public func get(_ url: URI, headers: HTTPHeaders = [:], beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture<ClientResponse>  

post(_:​headers:​before​Send:​)

public func post(_ url: URI, headers: HTTPHeaders = [:], beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture<ClientResponse>  

patch(_:​headers:​before​Send:​)

public func patch(_ url: URI, headers: HTTPHeaders = [:], beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture<ClientResponse>  

put(_:​headers:​before​Send:​)

public func put(_ url: URI, headers: HTTPHeaders = [:], beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture<ClientResponse>  

delete(_:​headers:​before​Send:​)

public func delete(_ url: URI, headers: HTTPHeaders = [:], beforeSend: (inout ClientRequest) throws -> () = { _ in }) -> EventLoopFuture<ClientResponse>  

post(_:​headers:​content:​)

public func post<T>(_ url: URI, headers: HTTPHeaders = [:], content: T) -> EventLoopFuture<ClientResponse> where T: Content  

patch(_:​headers:​content:​)

public func patch<T>(_ url: URI, headers: HTTPHeaders = [:], content: T) -> EventLoopFuture<ClientResponse> where T: Content  

put(_:​headers:​content:​)

public func put<T>(_ url: URI, headers: HTTPHeaders = [:], content: T) -> EventLoopFuture<ClientResponse> where T: Content  

send(_:​headers:​to:​before​Send:​)

public func send(
        _ method: HTTPMethod,
        headers: HTTPHeaders = [:],
        to url: URI,
        beforeSend: (inout ClientRequest) throws -> () = { _ in }
    ) -> EventLoopFuture<ClientResponse>  

get(_:​headers:​before​Send:​)

public func get(_ url: URI, headers: HTTPHeaders = [:], beforeSend: (inout ClientRequest) throws -> () = { _ in }) async throws -> ClientResponse  

post(_:​headers:​before​Send:​)

public func post(_ url: URI, headers: HTTPHeaders = [:], beforeSend: (inout ClientRequest) throws -> () = { _ in }) async throws -> ClientResponse  

patch(_:​headers:​before​Send:​)

public func patch(_ url: URI, headers: HTTPHeaders = [:], beforeSend: (inout ClientRequest) throws -> () = { _ in }) async throws -> ClientResponse  

put(_:​headers:​before​Send:​)

public func put(_ url: URI, headers: HTTPHeaders = [:], beforeSend: (inout ClientRequest) throws -> () = { _ in }) async throws -> ClientResponse  

delete(_:​headers:​before​Send:​)

public func delete(_ url: URI, headers: HTTPHeaders = [:], beforeSend: (inout ClientRequest) throws -> () = { _ in }) async throws -> ClientResponse  

post(_:​headers:​content:​)

public func post<T>(_ url: URI, headers: HTTPHeaders = [:], content: T) async throws -> ClientResponse where T: Content  

patch(_:​headers:​content:​)

public func patch<T>(_ url: URI, headers: HTTPHeaders = [:], content: T) async throws -> ClientResponse where T: Content  

put(_:​headers:​content:​)

public func put<T>(_ url: URI, headers: HTTPHeaders = [:], content: T) async throws -> ClientResponse where T: Content  

send(_:​headers:​to:​before​Send:​)

public func send(
        _ method: HTTPMethod,
        headers: HTTPHeaders = [:],
        to url: URI,
        beforeSend: (inout ClientRequest) throws -> () = { _ in }
    ) async throws -> ClientResponse  

send(_:​)

public func send(_ request: ClientRequest) async throws -> ClientResponse  

Requirements

event​Loop

var eventLoop: EventLoop  

byte​Buffer​Allocator

var byteBufferAllocator: ByteBufferAllocator  

delegating(to:​)

func delegating(to eventLoop: EventLoop) -> Client

logging(to:​)

func logging(to logger: Logger) -> Client

allocating(to:​)

func allocating(to byteBufferAllocator: ByteBufferAllocator) -> Client

send(_:​)

func send(_ request: ClientRequest) -> EventLoopFuture<ClientResponse>