Movatterモバイル変換


[0]ホーム

URL:


AsyncHTTPClient 1.4.1 Docs (89% documented)

GitHub View on GitHub

Dash Install in Dash

AsyncHTTPClient Reference HTTPClient Class Reference

HTTPClient

publicclassHTTPClient

HTTPClient class provides API for request execution.

Example:

letclient=HTTPClient(eventLoopGroupProvider:.createNew)client.get(url:"https://swift.org",deadline:.now()+.seconds(1)).whenComplete{resultinswitchresult{case.failure(leterror):// process errorcase.success(letresponse):ifletresponse.status==.ok{// handle response}else{// handle remote error}}}

It is important to close the client instance, for example in a defer statement, after use to cleanly shutdown the underlying NIOEventLoopGroup:

tryclient.syncShutdown()
Show on GitHub
  • Undocumented

    Declaration

    Swift

    publicleteventLoopGroup:EventLoopGroup
  • Create anHTTPClient with specifiedEventLoopGroup provider and configuration.

    Declaration

    Swift

    publicconvenienceinit(eventLoopGroupProvider:EventLoopGroupProvider,configuration:Configuration=Configuration())

    Parameters

    eventLoopGroupProvider

    Specify howEventLoopGroup will be created.

    configuration

    Client configuration.

  • Create anHTTPClient with specifiedEventLoopGroup provider and configuration.

    Declaration

    Swift

    publicrequiredinit(eventLoopGroupProvider:EventLoopGroupProvider,configuration:Configuration=Configuration(),backgroundActivityLogger:Logger)

    Parameters

    eventLoopGroupProvider

    Specify howEventLoopGroup will be created.

    configuration

    Client configuration.

  • Shuts down the client andEventLoopGroup if it was created by the client.

    Declaration

    Swift

    publicfuncsyncShutdown()throws
  • Shuts down the client and event loop gracefully. This function is clearly an outlier in that it uses a completioncallback instead of an EventLoopFuture. The reason for that is that NIO’s EventLoopFutures will call back on an event loop.The virtue of this function is to shut the event loop down. To work around that we call back on a DispatchQueueinstead.

    Declaration

    Swift

    publicfuncshutdown(queue:DispatchQueue=.global(),_callback:@escaping(Error?)->Void)
  • ExecuteGET request using specified URL.

    Declaration

    Swift

    publicfuncget(url:String,deadline:NIODeadline?=nil)->EventLoopFuture<Response>

    Parameters

    url

    Remote URL.

    deadline

    Point in time by which the request must complete.

  • ExecuteGET request using specified URL.

    Declaration

    Swift

    publicfuncget(url:String,deadline:NIODeadline?=nil,logger:Logger)->EventLoopFuture<Response>

    Parameters

    url

    Remote URL.

    deadline

    Point in time by which the request must complete.

    logger

    The logger to use for this request.

  • ExecutePOST request using specified URL.

    Declaration

    Swift

    publicfuncpost(url:String,body:Body?=nil,deadline:NIODeadline?=nil)->EventLoopFuture<Response>

    Parameters

    url

    Remote URL.

    body

    Request body.

    deadline

    Point in time by which the request must complete.

  • ExecutePOST request using specified URL.

    Declaration

    Swift

    publicfuncpost(url:String,body:Body?=nil,deadline:NIODeadline?=nil,logger:Logger)->EventLoopFuture<Response>

    Parameters

    url

    Remote URL.

    body

    Request body.

    deadline

    Point in time by which the request must complete.

    logger

    The logger to use for this request.

  • ExecutePATCH request using specified URL.

    Declaration

    Swift

    publicfuncpatch(url:String,body:Body?=nil,deadline:NIODeadline?=nil)->EventLoopFuture<Response>

    Parameters

    url

    Remote URL.

    body

    Request body.

    deadline

    Point in time by which the request must complete.

  • ExecutePATCH request using specified URL.

    Declaration

    Swift

    publicfuncpatch(url:String,body:Body?=nil,deadline:NIODeadline?=nil,logger:Logger)->EventLoopFuture<Response>

    Parameters

    url

    Remote URL.

    body

    Request body.

    deadline

    Point in time by which the request must complete.

    logger

    The logger to use for this request.

  • ExecutePUT request using specified URL.

    Declaration

    Swift

    publicfuncput(url:String,body:Body?=nil,deadline:NIODeadline?=nil)->EventLoopFuture<Response>

    Parameters

    url

    Remote URL.

    body

    Request body.

    deadline

    Point in time by which the request must complete.

  • ExecutePUT request using specified URL.

    Declaration

    Swift

    publicfuncput(url:String,body:Body?=nil,deadline:NIODeadline?=nil,logger:Logger)->EventLoopFuture<Response>

    Parameters

    url

    Remote URL.

    body

    Request body.

    deadline

    Point in time by which the request must complete.

    logger

    The logger to use for this request.

  • ExecuteDELETE request using specified URL.

    Declaration

    Swift

    publicfuncdelete(url:String,deadline:NIODeadline?=nil)->EventLoopFuture<Response>

    Parameters

    url

    Remote URL.

    deadline

    The time when the request must have been completed by.

  • ExecuteDELETE request using specified URL.

    Declaration

    Swift

    publicfuncdelete(url:String,deadline:NIODeadline?=nil,logger:Logger)->EventLoopFuture<Response>

    Parameters

    url

    Remote URL.

    deadline

    The time when the request must have been completed by.

    logger

    The logger to use for this request.

  • Execute arbitrary HTTP request using specified URL.

    Declaration

    Swift

    publicfuncexecute(_method:HTTPMethod=.GET,url:String,body:Body?=nil,deadline:NIODeadline?=nil,logger:Logger?=nil)->EventLoopFuture<Response>

    Parameters

    method

    Request method.

    url

    Request url.

    body

    Request body.

    deadline

    Point in time by which the request must complete.

    logger

    The logger to use for this request.

  • Execute arbitrary HTTP+UNIX request to a unix domain socket path, using the specified URL as the request to send to the server.

    Declaration

    Swift

    publicfuncexecute(_method:HTTPMethod=.GET,socketPath:String,urlPath:String,body:Body?=nil,deadline:NIODeadline?=nil,logger:Logger?=nil)->EventLoopFuture<Response>

    Parameters

    method

    Request method.

    socketPath

    The path to the unix domain socket to connect to.

    urlPath

    The URL path and query that will be sent to the server.

    body

    Request body.

    deadline

    Point in time by which the request must complete.

    logger

    The logger to use for this request.

  • Execute arbitrary HTTPS+UNIX request to a unix domain socket path over TLS, using the specified URL as the request to send to the server.

    Declaration

    Swift

    publicfuncexecute(_method:HTTPMethod=.GET,secureSocketPath:String,urlPath:String,body:Body?=nil,deadline:NIODeadline?=nil,logger:Logger?=nil)->EventLoopFuture<Response>

    Parameters

    method

    Request method.

    secureSocketPath

    The path to the unix domain socket to connect to.

    urlPath

    The URL path and query that will be sent to the server.

    body

    Request body.

    deadline

    Point in time by which the request must complete.

    logger

    The logger to use for this request.

  • Execute arbitrary HTTP request using specified URL.

    Declaration

    Swift

    publicfuncexecute(request:Request,deadline:NIODeadline?=nil)->EventLoopFuture<Response>

    Parameters

    request

    HTTP request to execute.

    deadline

    Point in time by which the request must complete.

  • Execute arbitrary HTTP request using specified URL.

    Declaration

    Swift

    publicfuncexecute(request:Request,deadline:NIODeadline?=nil,logger:Logger)->EventLoopFuture<Response>

    Parameters

    request

    HTTP request to execute.

    deadline

    Point in time by which the request must complete.

    logger

    The logger to use for this request.

  • Execute arbitrary HTTP request using specified URL.

    Declaration

    Swift

    publicfuncexecute(request:Request,eventLoop:EventLoopPreference,deadline:NIODeadline?=nil)->EventLoopFuture<Response>

    Parameters

    request

    HTTP request to execute.

    eventLoop

    NIO Event Loop preference.

    deadline

    Point in time by which the request must complete.

  • Execute arbitrary HTTP request and handle response processing using provided delegate.

    Declaration

    Swift

    publicfuncexecute(request:Request,eventLoopeventLoopPreference:EventLoopPreference,deadline:NIODeadline?=nil,logger:Logger?)->EventLoopFuture<Response>

    Parameters

    request

    HTTP request to execute.

    eventLoop

    NIO Event Loop preference.

    deadline

    Point in time by which the request must complete.

    logger

    The logger to use for this request.

  • Execute arbitrary HTTP request and handle response processing using provided delegate.

    Declaration

    Swift

    publicfuncexecute<Delegate:HTTPClientResponseDelegate>(request:Request,delegate:Delegate,deadline:NIODeadline?=nil)->Task<Delegate.Response>

    Parameters

    request

    HTTP request to execute.

    delegate

    Delegate to process response parts.

    deadline

    Point in time by which the request must complete.

  • Execute arbitrary HTTP request and handle response processing using provided delegate.

    Declaration

    Swift

    publicfuncexecute<Delegate:HTTPClientResponseDelegate>(request:Request,delegate:Delegate,deadline:NIODeadline?=nil,logger:Logger)->Task<Delegate.Response>

    Parameters

    request

    HTTP request to execute.

    delegate

    Delegate to process response parts.

    deadline

    Point in time by which the request must complete.

    logger

    The logger to use for this request.

  • Execute arbitrary HTTP request and handle response processing using provided delegate.

    Declaration

    Swift

    publicfuncexecute<Delegate:HTTPClientResponseDelegate>(request:Request,delegate:Delegate,eventLoopeventLoopPreference:EventLoopPreference,deadline:NIODeadline?=nil)->Task<Delegate.Response>

    Parameters

    request

    HTTP request to execute.

    delegate

    Delegate to process response parts.

    eventLoop

    NIO Event Loop preference.

    deadline

    Point in time by which the request must complete.

    logger

    The logger to use for this request.

  • Execute arbitrary HTTP request and handle response processing using provided delegate.

    Declaration

    Swift

    publicfuncexecute<Delegate:HTTPClientResponseDelegate>(request:Request,delegate:Delegate,eventLoopeventLoopPreference:EventLoopPreference,deadline:NIODeadline?=nil,loggeroriginalLogger:Logger?)->Task<Delegate.Response>

    Parameters

    request

    HTTP request to execute.

    delegate

    Delegate to process response parts.

    eventLoop

    NIO Event Loop preference.

    deadline

    Point in time by which the request must complete.

  • HTTPClient configuration.

    See more

    Declaration

    Swift

    publicstructConfiguration
  • Specifies howEventLoopGroup will be created and establishes lifecycle ownership.

    See more

    Declaration

    Swift

    publicenumEventLoopGroupProvider
  • Specifies how the library will treat event loop passed by the user.

    See more

    Declaration

    Swift

    publicstructEventLoopPreference
    extensionHTTPClient.EventLoopPreference:CustomStringConvertible
  • Specifies decompression settings.

    See more

    Declaration

    Swift

    publicenumDecompression
  • A representation of an HTTP cookie.

    See more

    Declaration

    Swift

    publicstructCookie
  • Represent HTTP response.

    See more

    Declaration

    Swift

    publicstructResponse
  • Represent request body.

    See more

    Declaration

    Swift

    publicstructBody
  • Represent HTTP request.

    See more

    Declaration

    Swift

    publicstructRequest
  • HTTP authentication

    See more

    Declaration

    Swift

    publicstructAuthorization:Hashable
  • Response execution context. Will be created by the library and could be used for obtainingEventLoopFuture<Response> of the execution or cancellation of the execution.

    See more

    Declaration

    Swift

    publicfinalclassTask<Response>

© 2023AsyncHTTPClient team. All rights reserved. (Last updated: 2023-01-17)

Generated byjazzy ♪♫ v0.14.3, aRealm project.


[8]ページ先頭

©2009-2025 Movatter.jp