Skip to main content

Class NetworkPostRequest

A base class for data request posting data over network.

public abstract class NetworkPostRequest : IRequest

Inheritance​

Derived​

JsonPostRequest

Implements​

IRequest

Remarks​

Create a subclass that inherits from NetworkPostRequest to send your own data.

Constructors​

NetworkPostRequest()​

Initializes a new instance of the NetworkPostRequest class using configuration from project settings.

public NetworkPostRequest()

NetworkPostRequest(string, int, int)​

Initializes a new instance of the NetworkPostRequest class with custom parameters.

public NetworkPostRequest(string baseURL, int timeOut = 12, int retryCount = 5)

Parameters​

NameTypeDescription
baseURLstringThe server URL to send the POST request to.
timeOutintThe timeout duration (in seconds) for the request.
retryCountintThe number of retry attempts on failure.

Methods​

CreateMultipartFormData()​

Creates the multipart form data for a POST request using UnityWebRequest.

protected virtual List<IMultipartFormSection> CreateMultipartFormData()

Returns​

List<IMultipartFormSection> — A list of IMultipartFormSection representing the form data to be sent.

Remarks​

This base implementation includes only the user ID.
To send additional data, override this method in a derived class.

HandleRequest()​

Carries out the data operation (network POST, file write, etc.) and yields until complete.

Performs request by compressing and sending the JSON data to the target URI.

public IEnumerator HandleRequest()

Returns​

IEnumerator