AdaptySDK 4.1.1
Loading...
Searching...
No Matches
AdaptySDK.AdaptyRequest Class Reference

The one way a public method reaches the native side, and the one place a request names itself when the app's completion handler throws. More...

Static Package Functions

static void Send< T > (string method, object request, Action< T, AdaptyError > completionHandler, [CallerMemberName] string caller=null)
 Sends one request to the native side and hands the typed reply to completionHandler .
static void SendVoid (string method, object request, Action< AdaptyError > completionHandler, [CallerMemberName] string caller=null)
 Sends one request whose reply carries no value of its own, and reports only the error.
static void FailWrongParam (string method, string detail, Action< AdaptyError > completionHandler, [CallerMemberName] string caller=null)
 Reports an argument the SDK can see is wrong before sending — a null the request cannot carry, a graph that cannot be encoded — with the code the native side answers a wrong argument with.
static void FailWrongParam< T > (string method, string detail, Action< T, AdaptyError > completionHandler, [CallerMemberName] string caller=null)
 The typed twin of FailWrongParam(string, string, Action<AdaptyError>, string), for a request whose reply carries a value.

Static Private Member Functions

static void InvokeCompletion (Action invocation, string caller)
 Names the request that is calling back, and hands the call to the one callback policy.
static AdaptyError WrongParam (string method, string detail)
static void SendRaw< T > (string method, object request, Action< T, AdaptyError > completionHandler)

Detailed Description

The one way a public method reaches the native side, and the one place a request names itself when the app's completion handler throws.

Send<T> and SendVoid are the only entry points: the raw transport is private, so a call site cannot reach the bridge without the guard, and neither can spell the diagnostic wrong - [CallerMemberName] is what fills the name in.

Member Function Documentation

◆ FailWrongParam()

void AdaptySDK.AdaptyRequest.FailWrongParam ( string method,
string detail,
Action< AdaptyError > completionHandler,
[CallerMemberName] string caller = null )
staticpackage

Reports an argument the SDK can see is wrong before sending — a null the request cannot carry, a graph that cannot be encoded — with the code the native side answers a wrong argument with.

Without this the failure would leave the SDK synchronously, or ride to the native side as a null, and those call sites would report failure differently from every other public method.

◆ FailWrongParam< T >()

void AdaptySDK.AdaptyRequest.FailWrongParam< T > ( string method,
string detail,
Action< T, AdaptyError > completionHandler,
[CallerMemberName] string caller = null )
staticpackage

The typed twin of FailWrongParam(string, string, Action<AdaptyError>, string), for a request whose reply carries a value.

◆ InvokeCompletion()

void AdaptySDK.AdaptyRequest.InvokeCompletion ( Action invocation,
string caller )
staticprivate

Names the request that is calling back, and hands the call to the one callback policy.

The wrapping itself belongs to AdaptyCallbacks.InvokeSafe - what lives here is only the wording, in one place, so that the 40 requests cannot drift apart.

◆ Send< T >()

void AdaptySDK.AdaptyRequest.Send< T > ( string method,
object request,
Action< T, AdaptyError > completionHandler,
[CallerMemberName] string caller = null )
staticpackage

Sends one request to the native side and hands the typed reply to completionHandler .

Parameters
methodThe method name the bridge dispatches on.
requestThe parameters, either a model or a JObject built at the call site. Null sends the method alone.
completionHandlerCalled with the decoded reply, or with the error the reply carried.
callerThe public method the request was made from, filled in by the compiler. It names the call in the diagnostic when the app's handler throws.

◆ SendRaw< T >()

void AdaptySDK.AdaptyRequest.SendRaw< T > ( string method,
object request,
Action< T, AdaptyError > completionHandler )
staticprivate

◆ SendVoid()

void AdaptySDK.AdaptyRequest.SendVoid ( string method,
object request,
Action< AdaptyError > completionHandler,
[CallerMemberName] string caller = null )
staticpackage

Sends one request whose reply carries no value of its own, and reports only the error.

Parameters
methodThe method name the bridge dispatches on.
requestThe parameters, either a model or a JObject built at the call site. Null sends the method alone.
completionHandlerCalled with the error the reply carried, or null.
callerThe public method the request was made from, filled in by the compiler. It names the call in the diagnostic when the app's handler throws.

◆ WrongParam()

AdaptyError AdaptySDK.AdaptyRequest.WrongParam ( string method,
string detail )
staticprivate

The documentation for this class was generated from the following file: