Applilink SDK HTTP transport, retry policy, and response parsing.
More...
#include <ApplilinkWebAPI.h>
Applilink SDK HTTP transport, retry policy, and response parsing.
◆ calcelSessionConnection
| + (void) calcelSessionConnection |
|
|
|
Clear the session-connection wait gate.
The binary spells this selector calcelSessionConnection without correcting the cancel typo.
- Ghidra address:
- 0x253bd0
◆ canUseNetworkRetry
| - (BOOL) canUseNetworkRetry |
|
|
|
Whether this device's operating-system version supports the network-retry policy.
- Returns
YES when the operating-system version is at least 6.0.
- Ghidra address:
- 0x253bf0
◆ commonParameters
| - (NSDictionary *) commonParameters |
|
|
|
The parameters common to every applilink request.
- Returns
- A dictionary carrying
cr=0 and format=json .
- Ghidra address:
- 0x2512ac
◆ init
Initial value:
Initialise the transport with a cleared retry counter.
- Returns
- The initialised instance.
- Ghidra address:
- 0x251250
◆ requestAsynchronousWithURL:method:parameters:userInfo:tag:cachePolicy:timeout:retry:finishedBlock:failedBlock: [1/2]
| + (void) requestAsynchronousWithURL: |
|
(nullable NSString *) | URL |
| method: |
|
(nullable NSString *) | method |
| parameters: |
|
(nullable NSDictionary *) | parameters |
| userInfo: |
|
(nullable id) | userInfo |
| tag: |
|
(NSInteger) | tag |
| cachePolicy: |
|
(nullable NSNumber *) | cachePolicy |
| timeout: |
|
(float) | timeout |
| retry: |
|
(BOOL) | retry |
| finishedBlock: |
|
(nullable ApplilinkWebAPIFinishedBlock) | finishedBlock |
| failedBlock: |
|
(nullable ApplilinkWebAPIFailedBlock) | failedBlock |
Convenience class factory for the asynchronous request.
The work is dispatched to a global concurrent queue, where a throwaway instance sends the request through the instance method of the same selector.
- Parameters
-
| URL | The base URL string. |
| method | The HTTP method. |
| parameters | The request parameters. |
| userInfo | Caller context; the callback blocks are instead handed the sent request. |
| tag | A caller-supplied request tag. |
| cachePolicy | The cache policy as a boxed NSNumber , or nil for the default policy. |
| timeout | The request timeout, in seconds. |
| retry | Whether the request participates in the timeout-retry policy. |
| finishedBlock | The success callback. |
| failedBlock | The failure callback. |
- Ghidra address:
- 0x253604
◆ requestAsynchronousWithURL:method:parameters:userInfo:tag:cachePolicy:timeout:retry:finishedBlock:failedBlock: [2/2]
| - (void) requestAsynchronousWithURL: |
|
(nullable NSString *) | URL |
| method: |
|
(nullable NSString *) | method |
| parameters: |
|
(nullable NSDictionary *) | parameters |
| userInfo: |
|
(nullable id) | userInfo |
| tag: |
|
(NSInteger) | tag |
| cachePolicy: |
|
(nullable NSNumber *) | cachePolicy |
| timeout: |
|
(float) | timeout |
| retry: |
|
(BOOL) | retry |
| finishedBlock: |
|
(nullable ApplilinkWebAPIFinishedBlock) | finishedBlock |
| failedBlock: |
|
(nullable ApplilinkWebAPIFailedBlock) | failedBlock |
Send a request asynchronously with a bounded timeout-retry policy.
The request is blocked while a session regeneration is in flight, short-circuited when it is itself the session-regeneration request, then sent through NSURLConnection on the main queue. On older operating-system versions, or when retry is set, a GCD timer re-issues the request up to the retry cap. The completion handler parses the JSON body and invokes finishedBlock or failedBlock .
- Parameters
-
| URL | The base URL string. |
| method | The HTTP method. |
| parameters | The request parameters. |
| userInfo | Caller context; the callback blocks are instead handed the sent request. |
| tag | A caller-supplied request tag. |
| cachePolicy | The cache policy as a boxed NSNumber , or nil for the default policy. |
| timeout | The request timeout, in seconds. |
| retry | Whether the request participates in the timeout-retry policy. |
| finishedBlock | The success callback. |
| failedBlock | The failure callback. |
- Ghidra address:
- 0x251a30
◆ requestForGetWithURL:parameters:
| - (nullable NSMutableURLRequest *) requestForGetWithURL: |
|
(nullable NSString *) | URL |
| parameters: |
|
(nullable NSDictionary *) | parameters |
Build a GET request, appending the parameters to the URL as a query string.
- Parameters
-
| URL | The base URL string. |
| parameters | The parameters to append. |
- Returns
- The GET request.
- Ghidra address:
- 0x2514cc
◆ requestForPostWithURL:parameters:
| - (nullable NSMutableURLRequest *) requestForPostWithURL: |
|
(nullable NSString *) | URL |
| parameters: |
|
(nullable NSDictionary *) | parameters |
Build a POST request, serialising the parameters into a form-encoded body.
Each value is percent-joined into a key=value pair; an array value expands into repeated key[]=value pairs. The pairs are joined with & and set as the request body with a Content-Type of application/x-www-form-urlencoded .
- Parameters
-
| URL | The URL string. |
| parameters | The parameters to serialise. |
- Returns
- The POST request.
- Ghidra address:
- 0x25159c
◆ requestSynchronousWithURL:method:parameters:cachePolicy:error: [1/2]
| + (nullable id) requestSynchronousWithURL: |
|
(nullable NSString *) | URL |
| method: |
|
(nullable NSString *) | method |
| parameters: |
|
(nullable NSDictionary *) | parameters |
| cachePolicy: |
|
(nullable NSNumber *) | cachePolicy |
| error: |
|
(NSError *_Nullable *_Nullable) | error |
Convenience class factory for requestSynchronousWithURL:method:parameters:cachePolicy: error:.
- Parameters
-
| URL | The base URL string. |
| method | The HTTP method. |
| parameters | The request parameters. |
| cachePolicy | The cache policy as a boxed NSNumber , or nil for the default policy. |
| error | On failure, the localised error; may be nullptr. |
- Returns
- The parsed JSON response, or
nil on failure.
- Ghidra address:
- 0x253930
◆ requestSynchronousWithURL:method:parameters:cachePolicy:error: [2/2]
| - (nullable id) requestSynchronousWithURL: |
|
(nullable NSString *) | URL |
| method: |
|
(nullable NSString *) | method |
| parameters: |
|
(nullable NSDictionary *) | parameters |
| cachePolicy: |
|
(nullable NSNumber *) | cachePolicy |
| error: |
|
(NSError *_Nullable *_Nullable) | error |
Send a request synchronously with a bounded timeout-retry loop and parse the JSON body.
The request is sent through NSURLConnection with a ten-second timeout. Server errors in the 400-599 range, and connection timeouts, are retried up to the retry cap; on final failure a localised ApplilinkNetworkError is written to error . On success the parsed JSON object is returned.
- Parameters
-
| URL | The base URL string. |
| method | The HTTP method. |
| parameters | The request parameters. |
| cachePolicy | The cache policy as a boxed NSNumber , or nil for the default policy. |
| error | On failure, the localised error; may be nullptr. |
- Returns
- The parsed JSON response, or
nil on failure.
- Ghidra address:
- 0x253270
◆ requestWithURL:method:parameters:timeout:cachePolicy:
| - (nullable NSMutableURLRequest *) requestWithURL: |
|
(nullable NSString *) | URL |
| method: |
|
(nullable NSString *) | method |
| parameters: |
|
(nullable NSDictionary *) | parameters |
| timeout: |
|
(float) | timeout |
| cachePolicy: |
|
(nullable NSNumber *) | cachePolicy |
Build a request for a URL, method, parameters, timeout, and cache policy.
The parameters are merged with commonParameters , then dispatched to requestForGetWithURL:parameters: or requestForPostWithURL:parameters: depending on whether method equals "POST". The HTTP method, timeout, and cache policy are then applied. The timeout is a float and the cache policy is an object (a boxed NSNumber ), both taken from the selector's type encoding @52@0:8@16@24@32f40@44 rather than an NSTimeInterval or an NSURLRequestCachePolicy .
- Parameters
-
| URL | The base URL string. |
| method | The HTTP method; "POST" selects the POST body path, anything else the GET query path. |
| parameters | The request parameters. |
| timeout | The request timeout, in seconds. |
| cachePolicy | The cache policy as a boxed NSNumber , or nil for the default policy. |
- Returns
- The configured request.
- Ghidra address:
- 0x251304
◆ responseFromContentsServer:request:data:finishedBlock:failedBlock: [1/2]
Convenience class factory for responseFromContentsServer:request:data:finishedBlock: failedBlock:.
- Parameters
-
| response | The request URL, matched against the contents-server URL. |
| request | The request that was sent, handed back to failedBlock . |
| data | The raw response data. |
| finishedBlock | The success callback (unused on this path). |
| failedBlock | The failure callback. |
- Returns
- The value forwarded from the instance method.
- Ghidra address:
- 0x253a30
◆ responseFromContentsServer:request:data:finishedBlock:failedBlock: [2/2]
Parse a contents-server response and dispatch any failure.
When response equals the reward contents-server URL (the ApplilinkReward.appliURL default) and data is non-empty, the newline-delimited body is parsed: the first line carries the status and the remaining lines are accumulated. A status of "1" returns the accumulated body encoded as NSData without invoking finishedBlock ; any other status delivers a localised ApplilinkNetworkError to failedBlock . A malformed or missing body delivers a localised error too. When response is not the contents-server URL, data is returned unchanged; the asynchronous completion handler then JSON-parses that returned value.
- Parameters
-
| response | The request URL, matched against the contents-server URL. |
| request | The request that was sent, handed back to failedBlock . |
| data | The raw response data. |
| finishedBlock | The success callback (unused on this path). |
| failedBlock | The failure callback. |
- Returns
- The accumulated body data on the contents-server success path, otherwise
data .
- Ghidra address:
- 0x252c58
◆ retryCancel
Cancel the timeout-retry policy for outstanding requests.
- Ghidra address:
- 0x253b44
◆ setSessionConnectionWait:
| + (void) setSessionConnectionWait: |
|
(BOOL) | sessionConnectionWait |
|
Arm or disarm the session-connection wait gate.
When set, asynchronous requests block until the gate clears; the gate is auto-cleared after ten seconds through calcelSessionConnection .
- Parameters
-
| sessionConnectionWait | YES to arm the gate, NO to clear it. |
- Ghidra address:
- 0x253b54
◆ setSessionStatus:
| + (void) setSessionStatus: |
|
(BOOL) | sessionStatus |
|
Set whether the session is established, gating the session-regeneration short circuit.
- Parameters
-
| sessionStatus | YES when the session is established. |
- Ghidra address:
- 0x253be0
The documentation for this class was generated from the following files: