tencent cloud

Feedback

Last updated: 2023-07-26 15:32:06

    API Overview

    API
    Description
    Session management APIs
    QUIC request configuration
    Task management APIs
    Request serialization APIs
    Response serialization APIs

    TQUICHTTPSessionManager

    API
    Description
    manager
    A static method to construct a TQUICHTTPSessionManager instance.
    Create a TQUICHTTPSessionManager instance with the specified configuration. For detailed configuration, see TQUICURLSessionConfiguration
    Create a TQUICHTTPSessionManager instance with the specified URL.
    GET
    Initiate a GET request.
    POST
    Initiate a POST request.

    manger

    Create a TQUICHTTPSessionManager instance and pass the default QUIC configuration.
    
    + (instancetype)manager

    initWithSessionConfiguration

    Create a TQUICHTTPSessionManager instance and pass the QUIC configuration.
    
    - (instancetype)initWithSessionConfiguration:(nullable %!s(<nil>) *)configuration
    Parameter
    Description
    configuration
    QUIC request configuration. For details, see TQUICURLSessionConfiguration.

    initWithBaseURL

    Create a TQUICHTTPSessionManager instance and pass the specified URL.
    
    - (instancetype)initWithBaseURL:(nullable NSURL *)baseURL;
    
    - (instancetype)initWithBaseURL:(nullable NSURL *)baseURL
    
               sessionConfiguration:(nullable %!s(<nil>) *)configuration;
    Parameter
    Description
    baseURL
    The request domain name.
    configuration
    QUIC request configuration. For details, see TQUICURLSessionConfiguration.

    GET

    Create a GET request.
    
    - (nullable TQUICURLSessionDataTask *)GET:(NSString *)URLString
    
                                   parameters:(nullable id)parameters
    
                                      headers:(nullable NSDictionary <NSString *, NSString *> *)headers
    
                              timeoutInterval:(NSTimeInterval)timeoutInterval
    
                             downloadProgress:(nullable %!s(<nil>))downloadProgress
    
                                      success:(nullable %!s(<nil>))success
    
                                      failure:(nullable %!s(<nil>))failure
    Parameter
    Description
    URLString
    The request URL.
    parameters
    The request parameters.
    headers
    The request headers.
    timeoutInterval
    The connection timeout.
    downloadProgress
    The callback for download progress.
    success
    The callback for request success.
    failure
    The callback for request failure.

    POST

    Create a POST Request.
    
    - (nullable TQUICURLSessionDataTask *)POST:(NSString *)URLString
    
                                    parameters:(nullable id)parameters
    
                                       headers:(nullable NSDictionary <NSString *, NSString *> *)headers
    
                               timeoutInterval:(NSTimeInterval)timeoutInterval
    
                                uploadProgress:(nullable %!s(<nil>))uploadProgress
    
                                       success:(nullable %!s(<nil>))success
    
                                       failure:(nullable TQUICURLSessionTask)failure
    Parameter
    Description
    URLString
    The request URL.
    parameters
    The request parameters.
    headers
    The request headers.
    timeoutInterval
    The connection timeout.
    uploadProgress
    The callback to be executed to get upload progress.
    success
    The callback to be executed upon request success.
    failure
    The callback to be executed upon request failure.

    TQUICURLSessionTaskSuccess

    Execute the callback for task success.
    typedef void (^TQUICURLSessionTaskSuccess)(%!s(<nil>) *task, id _Nullable responseObject)
    Parameter
    Description
    task
    The request task.
    responseObject
    The response data.

    TQUICURLSessionTaskFailure

    Execute the callback for task failure.
    typedef void (^TQUICURLSessionTaskFailure)(%!s(<nil>) * _Nullable task, NSError *error)
    Parameter
    Description
    task
    The request task.
    error
    The error message.

    TQUICURLSessionManager

    Session management APIs
    API
    Description
    Create an instance with the specified configuration.
    Initiate requests with the NSURLRequest parameter.
    Set the callback to collect statistics.
    Set the callback block to receive request response.

    initWithSessionConfiguration

    Create a TQUICURLSessionManager instance and pass the QUIC configuration.
    - (instancetype)initWithSessionConfiguration:(nullable %!s(<nil>) *)configuration
    Parameter
    Description
    configuration
    QUIC request configuration.

    dataTaskWithRequest

    Initiate requests with the NSURLRequest parameter.
    - (TQUICURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)request
                                      uploadProgress:(nullable %!s(<nil>))uploadProgress
                                    downloadProgress:(nullable %!s(<nil>))downloadProgress
                                   completionHandler:(nullable %!s(<nil>))completionHandler
    Parameter
    Description
    request
    For detailed configuration, see NSURLRequest.
    uploadProgress
    The callback to be executed to get upload progress.
    downloadProgress
    The callback to be executed to get download progress.
    completionHandler
    The callback to be executed upon request completion.

    setTaskDidFinishCollectingMetricsBlock

    Set the callback to collect statistics.
    - (void)setTaskDidFinishCollectingMetricsBlock:(nullable %!s(<nil>))block
    Parameter
    Description
    block
    Execute the callback block to collect statistics when the request is complete.

    setTaskDidReceiveResponseBlock

    Set the callback block to receive request response.
    - (void)setTaskDidReceiveResponseBlock:(nullable %!s(<nil>))block
    Parameter
    Description
    block
    Execute the callback block to receive request response.

    TQUICURLSessionTaskDidReceiveResponseBlock

    Execute the callback block to receive session task response.
    typedef void (^TQUICURLSessionTaskDidReceiveResponseBlock)(%!s(<nil>) *session, %!s(<nil>) *task, NSURLResponse *response)
    Parameter
    Description
    session
    The class that manages sessions.
    task
    The class that manages tasks.
    response
    The response result.

    TQUICURLSessionTaskDownloadProgressBlock

    Execute the callback block to get download progress.
    
    typedef void (^TQUICURLSessionTaskDownloadProgressBlock)(NSProgress *downloadProgress)
    Parameter
    Description
    downloadProgress
    The download progress.

    TQUICURLSessionTaskUploadProgressBlock

    Execute the callback block to get upload progress.
    
    typedef void (^TQUICURLSessionTaskUploadProgressBlock)(NSProgress *uploadProgress)
    Parameter
    Description
    uploadProgress
    The upload progress.

    QUICURLSessionTaskCompletionHandler

    Execute the callback block upon session completion.
    typedef void (^TQUICURLSessionTaskCompletionHandler)(NSURLResponse *response, id responseObject, NSError *error)
    Parameter
    Description
    response
    For details about the response result, see NSURLResponse.
    responseObject
    The response data.
    error
    The error message.

    TQUICURLSessionTaskDidFinishCollectingMetricsBlock

    Execute the callback block to collect statistics upon session completion.
    typedef void (^TQUICURLSessionTaskDidFinishCollectingMetricsBlock)(TQUICURLSession *session, TQUICURLSessionTask *task, TQUICURLSessionTaskMetrics * _Nullable metrics)
    Parameter
    Description
    session
    Session management.
    task
    Task management.
    metrics
    The network statistics.

    TQUICURLSessionConfiguration

    QUIC request configuration.
    Member variable
    Description
    quicVersion
    Set the QUIC version. Supported versions: 043, Q046, Q050, Q051, draft-29, RFC-V1 (RFC 9000). Values:
    TQUICVersionQ043 (default)
    TQUICVersion046 audio/video proxy
    TQUICVersion050 audio/video proxy
    TQUICVersion051 audio/video proxy
    TQUICVersionDraft29 audio/video proxy
    TQUICVersionRFCV1 audio/video proxy
    congestionType
    Supported congestion algorithms: CubicBytes, RenoBytes, BBR, PCC, GCC.
    Values:
    TQUICCongestionTypeBBR (default)
    TQUICCongestionTypeCubicBytes
    TQUICCongestionTypeRenoBytes
    TQUICCongestionTypePCC
    TQUICCongestionTypeGCC
    connectTimeoutMillis
    The connection timeout in milliseconds. Default value: 60000.
    idleTimeoutMillis
    The idle connection timeout in milliseconds. This setting will affect connection reuse. Default value: 90000.
    ipv6Enabled audio/video proxy
    Whether to support IPv6. Values: YES, NO (default).
    dnsParser
    The custom DNS parser. For details, see TQUICDNSParserDelegate.

    TQUICDNSParserDelegate

    Implement a custom DNS parsing.
    
    - (NSString *)lookup:(NSString *)hostName
    Parameter
    Description
    hostName
    The domain name, which is called back to resolve an IP address.

    TQUICURLSession

    Task management APIs
    API
    Description
    Create an instance with the specified configuration.
    Create an instance with the default configuration.
    Create a task with the request parameters.

    sessionWithConfiguration

    Create an instance with the specified configuration.
    + (instancetype)sessionWithConfiguration:(%!s(<nil>) *)configuration
    Parameter
    Description
    configuration
    The QUIC request configuration.

    sharedSession

    Create an instance with the default configuration.
    + (instancetype)sharedSession

    dataTaskWithRequest

    Create a task based on the request parameters.
    - (nullable %!s(<nil>) *)dataTaskWithRequest:(NSURLRequest *)request
    Parameter
    Description
    request
    The request parameters. For more details, see NSURLRequest.

    TQUICURLSessionTask

    Task management APIs.
    API
    Description
    resume
    Start a request task.
    cancel
    Cancel a request task.

    resume

    Start a request task.
    
    - (void)resume

    cancel

    Cancel a request task.
    
    - (void)cancel

    TQUICURLSessionDataTask

    Manage request tasks. This API inherits the TQUICURLSessionTask class.
    API
    Description
    resume
    Start a request task.
    cancel
    Cancel a request task.

    resume

    Start a request task.
    
    - (void)resume

    cancel

    Cancel a request task.
    
    - (void)cancel

    TQUICURLRequestSerialization

    API
    Description
    Serialize HTTP request parameters.
    Serialize JSON request parameters.

    TQUICHTTPRequestSerializer

    Request serialization APIs
    API
    Description
    Implement instantiation.
    setValue
    Set a value for the header field.
    Return the value that corresponds to the header field.
    Create NSMutableURLRequest.
    Create NSMutableURLRequest to transfer streaming data.

    serializer

    Create a TQUICHTTPRequestSerializer instance.
    + (instancetype)serializer

    setValue

    Set a value for the header field.
    - (void)setValue:(nullable NSString *)value forHTTPHeaderField:(NSString *)field
    Parameter
    Description
    value
    The value of the header field.
    field
    The name of the header field.

    valueForHTTPHeaderField

    Return the value that corresponds to the header field.
    - (nullable NSString *)valueForHTTPHeaderField:(NSString *)field
    Parameter
    Description
    field
    The name of the header field.

    requestWithMethod

    Create NSMutableURLRequest.
    - (nullable NSMutableURLRequest *)requestWithMethod:(NSString *)method
    
                                              URLString:(NSString *)URLString
    
                                             parameters:(nullable id)parameters
    
                                                  error:(NSError * _Nullable __autoreleasing *)error
    Parameter
    Description
    method
    Set the HTTP request method, such as GET, POST, PUT, DELETE, HEAD and PATCH.
    URLString
    The request URL.
    parameters
    The request parameters.
    error
    The error message.

    multipartFormRequestWithMethod

    - (NSMutableURLRequest *)multipartFormRequestWithMethod:(NSString *)method
    
                                                  URLString:(NSString *)URLString
    
                                                 parameters:(nullable NSDictionary <NSString *, id> *)parameters
    
                                  constructingBodyWithBlock:(nullable void (^)(id <%!s(<nil>)> formData))block
    
                                                      error:(NSError * _Nullable __autoreleasing *)error
    Parameter
    Description
    method
    Set the HTTP request method, such as GET, POST, PUT, DELETE, HEAD and PATCH.
    URLString
    The request URL.
    parameters
    The request parameters.
    constructingBodyWithBlock
    Construct the body using the block.
    error
    The error message.

    TQUICJSONRequestSerializer

    API
    Description
    Create an instance.

    serializerWithWritingOptions

    Create a TQUICJSONRequestSerializer instance with the JSON serialization options.
    + (instancetype)serializerWithWritingOptions:(NSJSONWritingOptions)writingOptions
    Parameter
    Description
    writingOptions
    Create an instance with the JSON serialization options.

    TQUICMultipartFormData

    Multipart form data.
    API
    Description
    Upload the form data with the specified file URL.
    Upload the form data with the input stream.
    Upload form data using multipart.
    Add data parts.
    Add the header fields and body data to the form.
    The bandwidth limit for uploads.

    appendPartWithFileURL

    Upload the form data with the specified file URL.
    - (BOOL)appendPartWithFileURL:(NSURL *)fileURL
                             name:(NSString *)name
                            error:(NSError * _Nullable __autoreleasing *)error
    Parameter
    Description
    fileURL
    Add the file URL to the form.
    name
    The name of the associated file.
    error
    The error message.

    appendPartWithInputStream

    Upload data with the specified input stream.
    - (void)appendPartWithInputStream:(nullable NSInputStream *)inputStream
                                 name:(NSString *)name
                             fileName:(NSString *)fileName
                               length:(int64_t)length
                             mimeType:(NSString *)mimeType
    Parameter
    Description
    inputStream
    The input stream.
    name
    The name of the input stream.
    fileName
    The name of the file associated with the input stream.
    length
    The length of the stream in bytes.
    mimeType
    The MIME type, such as image/jpeg. For more details, see HTTP specifications.

    appendPartWithFileData

    Upload the form data using multipart.
    - (void)appendPartWithFileData:(NSData *)data
                              name:(NSString *)name
                          fileName:(NSString *)fileName
                          mimeType:(NSString *)mimeType
    Parameter
    Description
    data
    The data to be added to the form.
    name
    The name of the associated data.
    fileName
    The name of the associated file.
    mimeType
    The MIME type, such as image/jpeg. For more details, see HTTP specifications.

    appendPartWithFormData

    Add data parts.
    - (void)appendPartWithFormData:(NSData *)data
                              name:(NSString *)name
    Parameter
    Description
    data
    The data to be added to the form.
    name
    The name of the associated data.

    appendPartWithHeaders

    Add the header fields and body data to the form.
    - (void)appendPartWithHeaders:(nullable NSDictionary <NSString *, NSString *> *)headers
                             body:(NSData *)body;
    Parameter
    Description
    headers
    The headers to be added.
    body
    The body data to be added.

    throttleBandwidthWithPacketSize

    The bandwidth limit for uploads.
    - (void)throttleBandwidthWithPacketSize:(NSUInteger)numberOfBytes
                                      delay:(NSTimeInterval)delay
    Parameter
    Description
    numberOfBytes
    The maximum size of a packet in bytes. Default value: 16 KB.
    delay
    The read delay for a packet. Default value: 0 seconds.

    

    TQUICURLResponseSerialization

    Response serialization APIs
    API
    Description
    Serialize HTTP response data.
    Serialize JSON response data.

    TQUICHTTPResponseSerializer

    Response serialization APIs
    API
    Description
    Implement instantiation.
    Validate the response data.

    serializer

    Create a TQUICHTTPResponseSerializer instance.
    + (instancetype)serializer

    validateResponse

    Validate the response data.
    - (BOOL)validateResponse:(nullable NSHTTPURLResponse *)response
    
                        data:(nullable NSData *)data
    
                       error:(NSError * _Nullable __autoreleasing *)error
    Parameter
    Description
    response
    The response result to be validated. For more details, see NSHTTPURLResponse.
    data
    The returned data.
    error
    The validation error.

    TQUICJSONResponseSerializer

    API
    Description
    Create an instance.

    serializerWithWritingOptions

    Create an instance with the JSON serialization options.
    + (instancetype)serializerWithReadingOptions:(NSJSONReadingOptions)readingOptions
    Parameter
    Description
    serializerWithReadingOptions
    Create an instance with the JSON serialization options.

    TQUICURLSessionTaskMetrics

    The QUIC network metrics collected for a session.
    Property
    Description
    transactionMetrics
    An array of metrics for each request during the session. For more details, see TQUICURLSessionTaskTransactionMetrics.
    taskInterval
    The time taken between when the task is created and when the task is completed.
    redirectCount
    Number of redirects.

    TQUICURLSessionTaskTransactionMetrics

    The QUIC network metrics collected for a request.
    Property
    Description
    isValid
    Whether the value of status is valid.
    isQuic
    Whether it is a QUIC request.
    is0rtt
    Whether it is a 0-RTT connection.
    isConnReuse
    Whether the connection is reused.
    connectMillis
    Get the connection duration in milliseconds.
    dnsMillis
    Get the DNS duration in milliseconds.
    dnsCode
    Get the DNS error code.
    ttfbMillis
    Get the time taken for the first byte to be received in milliseconds.
    completeMillis
    Get the time taken for the request to be completed in milliseconds. The time taken by the connection is not included.
    srttMicros
    Get the average round-trip time in milliseconds.
    packetsSent
    Get the number of packets sent in bytes.
    packetsRetransmitted
    Get the number of packets retransmitted in bytes.
    bytesSent
    Get the number of bytes sent.
    bytesRetransmitted
    Get the number of bytes retransmitted.
    packetsLost
    Get the number of packets lost in bytes.
    packetsReceived
    Get the number of packets received in bytes.
    bytesReceived
    Get the number of bytes received.
    streamBytesReceived
    Get the number of bytes received within the stream.

    

    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support