It contains out-of-the-box chains for working with URL requests.
By default, the following nodes are implemented in the chain:
LoggerNode- outputs logsModelInputNode- maps the response fromRawMappabletoDTOConvertibleDTOMapperNode- maps the response fromDTOConvertibletoRawMappableMetadataConnectorNode- addsmetadatatoRequestModelRequestRouterNode- adds route to requestRequstEncoderNode- adds coding to requestUrlRequestTrasformatorNode- this node constructs a specificURLrequest, transformingmetadataintoheaders,routeintoURL, etc.RequestCreatorNode- creates a network request usingURLSessionTechnicaErrorMapperNode- maps technical errors (timeout, lack of internet connection, etc.)RequestSenderNode- sends a request to the networkResponseProcessorNode- handles the server response, checking whether the request was successful or not. If successful, it checks whether the response can be mapped to JSON or notResponseHttpErrorProcessorNode- this node handles checking whether any HTTP errors occurred (checks the code). If so, it creates an instance ofResponseHttpErrorProcessorNodeErrorand terminates the chain execution.ResponseDataPreprocessorNode- here we check the response.ResponseDataParserNode- obtainsJSONfromData
This chain DOES NOT contain caching.
build<I,O> - a classic request. Expects data both as input and output (described above)
build<Void, Void> - a chain that does not expect data either as input or output
build<I, Void> - a chain that expects data as input but does not return data (server responds with an empty body)
build<Void, I> - a chain that does not expect data as input but expects data as output (a classic GET request)
loadData<Void, Data> - a chain that simply downloads the required file (for example, downloading a statically served file)
loadData<I, Data> - a chain that downloads a file and sends some data to the server (which can happen)
build<I, O> where I.DTO.Raw = MultipartModel<[String : Data]> - a chain that allows sending multipart requests
set(query: [String: Any]) - changes the URL query parameter of the request.
set(boolEncodingStartegy: URLQueryBoolEncodingStartegy) - sets the strategy for parsing boolean variables into URL query parameters. Available out-of-the-box implementations: URLQueryBoolEncodingDefaultStrategy.asInt, URLQueryBoolEncodingDefaultStrategy.asBool. By default, URLQueryBoolEncodingDefaultStrategy.asInt is used.
set(arrayEncodingStrategy: URLQueryArrayKeyEncodingStartegy) - sets the strategy for parsing array keys into URL query parameters. Available out-of-the-box implementations: URLQueryArrayKeyEncodingBracketsStrategy.brackets, URLQueryArrayKeyEncodingBracketsStrategy.noBrackets. By default, URLQueryArrayKeyEncodingBracketsStrategy.brackets is used.
set(dictEncodindStrategy: URLQueryDictionaryKeyEncodingStrategy) - sets the strategy for parsing dictionary keys into URL query parameters. Only URLQueryDictionaryKeyEncodingDefaultStrategy is available out-of-the-box.
set(metadata: [String: String]) - sets the request headers that are added during the construction stage in the request (MetadataProviderNode). By default, the dictionary is empty.
route(_ method: Method, _ route: Route) - sets the HTTP method and URL for the request.
encode(as encoding: ParametersEncoding) - sets the encoding for the request. By default, .json is used.
add(provider: MetadataProvider) - adds a header provider to the request. These providers will be called immediately before sending the request.
log(exclude: [String]) - allows excluding certain specific logs by their ID. The node name is used as the ID for the log. More details.