Class SDKUtils
-
- All Implemented Interfaces:
public final class SDKUtils
-
-
Field Summary
Fields Modifier and Type Field Description public final static String
ALLOW_OPEN_URL
-
Method Summary
Modifier and Type Method Description final static OkHttpClient
addUniqueInterceptor(OkHttpClient $self, Interceptor interceptor, Boolean save)
Creates a new instance of OkHttpClient after adding the given interceptor, and saves it into ClientProvider if save is true. final static OkHttpClient
addUniqueInterceptor(OkHttpClient $self, Interceptor interceptor)
Creates a new instance of OkHttpClient after adding the given interceptor, and saves it into ClientProvider if save is true. final static OkHttpClient
addUniqueNetworkInterceptor(OkHttpClient $self, Interceptor interceptor, Boolean save)
Creates a new instance of OkHttpClient after adding the given network interceptor, and saves it into ClientProvider if save is true. final static OkHttpClient
addUniqueNetworkInterceptor(OkHttpClient $self, Interceptor interceptor)
Creates a new instance of OkHttpClient after adding the given network interceptor, and saves it into ClientProvider if save is true. final static OkHttpClient
removeInterceptor(OkHttpClient $self, Interceptor interceptor, Boolean save)
Removes the interceptor identified by the type of the given interceptor from the current OkHttpClient, and save the result back to ClientProvider if save is true. final static OkHttpClient
removeInterceptor(OkHttpClient $self, Interceptor interceptor)
Removes the interceptor identified by the type of the given interceptor from the current OkHttpClient, and save the result back to ClientProvider if save is true. final static <T extends KClass<out Interceptor>> OkHttpClient
removeInterceptorByType(OkHttpClient $self, T interceptorClazz, Boolean save)
Removes the interceptor of the given type interceptorClazz, and save it back to ClientProvider if save is true. final static <T extends KClass<out Interceptor>> OkHttpClient
removeInterceptorByType(OkHttpClient $self, T interceptorClazz)
Removes the interceptor of the given type interceptorClazz, and save it back to ClientProvider if save is true. final static OkHttpClient
removeDuplicateInterceptors(OkHttpClient $self, Boolean save)
Removes duplicate interceptors and network interceptors and save the result back to ClientProvider if save is true. final static Call
newSilentCall(OkHttpClient $self, Request request)
Creates a 'silent' call when refresh token expires or SAML session expires, automatic re-authentication process will not be started. final static OkHttpClient
silent(OkHttpClient $self)
Clones the 'OkHttpClient' into a silent mode, this is only applicable for OAuth2 and SAML, and mostly be used for OData calls. final static Boolean
isUnauthorized(Exception $self)
Checks whether the current 'Exception' is caused by OAuth token expiration. final static Boolean
isAttestationFailure(Exception $self)
final static <T extends SDKExceptions> Boolean
isCausedBy(Exception $self)
Checks whether the current 'Exception' is caused by Android Attestation. -
-
Method Detail
-
addUniqueInterceptor
final static OkHttpClient addUniqueInterceptor(OkHttpClient $self, Interceptor interceptor, Boolean save)
Creates a new instance of OkHttpClient after adding the given interceptor, and saves it into ClientProvider if save is true.
- Returns:
a new instance of OkHttpClient
-
addUniqueInterceptor
final static OkHttpClient addUniqueInterceptor(OkHttpClient $self, Interceptor interceptor)
Creates a new instance of OkHttpClient after adding the given interceptor, and saves it into ClientProvider if save is true.
- Returns:
a new instance of OkHttpClient
-
addUniqueNetworkInterceptor
final static OkHttpClient addUniqueNetworkInterceptor(OkHttpClient $self, Interceptor interceptor, Boolean save)
Creates a new instance of OkHttpClient after adding the given network interceptor, and saves it into ClientProvider if save is true.
- Returns:
a new instance of OkHttpClient
-
addUniqueNetworkInterceptor
final static OkHttpClient addUniqueNetworkInterceptor(OkHttpClient $self, Interceptor interceptor)
Creates a new instance of OkHttpClient after adding the given network interceptor, and saves it into ClientProvider if save is true.
- Returns:
a new instance of OkHttpClient
-
removeInterceptor
final static OkHttpClient removeInterceptor(OkHttpClient $self, Interceptor interceptor, Boolean save)
Removes the interceptor identified by the type of the given interceptor from the current OkHttpClient, and save the result back to ClientProvider if save is true.
-
removeInterceptor
final static OkHttpClient removeInterceptor(OkHttpClient $self, Interceptor interceptor)
Removes the interceptor identified by the type of the given interceptor from the current OkHttpClient, and save the result back to ClientProvider if save is true.
-
removeInterceptorByType
final static <T extends KClass<out Interceptor>> OkHttpClient removeInterceptorByType(OkHttpClient $self, T interceptorClazz, Boolean save)
Removes the interceptor of the given type interceptorClazz, and save it back to ClientProvider if save is true.
-
removeInterceptorByType
final static <T extends KClass<out Interceptor>> OkHttpClient removeInterceptorByType(OkHttpClient $self, T interceptorClazz)
Removes the interceptor of the given type interceptorClazz, and save it back to ClientProvider if save is true.
-
removeDuplicateInterceptors
final static OkHttpClient removeDuplicateInterceptors(OkHttpClient $self, Boolean save)
Removes duplicate interceptors and network interceptors and save the result back to ClientProvider if save is true.
-
newSilentCall
final static Call newSilentCall(OkHttpClient $self, Request request)
Creates a 'silent' call when refresh token expires or SAML session expires, automatic re-authentication process will not be started.
-
silent
final static OkHttpClient silent(OkHttpClient $self)
Clones the 'OkHttpClient' into a silent mode, this is only applicable for OAuth2 and SAML, and mostly be used for OData calls.
-
isUnauthorized
final static Boolean isUnauthorized(Exception $self)
Checks whether the current 'Exception' is caused by OAuth token expiration. This may usually be used in widget request calls when the widget wants to know the exact reason the request failure thus show meaningful messages on the UI.
-
isAttestationFailure
final static Boolean isAttestationFailure(Exception $self)
-
isCausedBy
final static <T extends SDKExceptions> Boolean isCausedBy(Exception $self)
Checks whether the current 'Exception' is caused by Android Attestation. This is usually being used to check the exception thrown from interceptors to see the real cause.
-
-
-
-