Beamable SDK
Public Member Functions | Properties | List of all members
Core.Platform.SDK.BeamableApiRequester Class Reference
Inheritance diagram for Core.Platform.SDK.BeamableApiRequester:
Inheritance graph
[legend]
Collaboration diagram for Core.Platform.SDK.BeamableApiRequester:
Collaboration graph
[legend]

Public Member Functions

 BeamableApiRequester (string host, AccessTokenStorage accessTokenStorage, IConnectivityService connectivityService)
 
void Dispose ()
 
Promise< T > Request< T > (Method method, string uri, object body=null, bool includeAuthHeader=true, Func< string, T > parser=null, bool useCache=false)
 Make an authorized request to the Beamable API. More...
 
IBeamableRequester WithAccessToken (TokenResponse tokenResponse)
 Create a new IBeamableRequester that will authenticate all requests using the given TokenResponse argument. WARNING, this method is not supported inside Microservices. More...
 
string EscapeURL (string url)
 A utility method that will url escape a string. More...
 

Properties

string Host [getset]
 
AccessToken Token [getset]
 
IAccessToken AccessToken [get]
 
string TimeOverride [getset]
 
string Language [getset]
 
- Properties inherited from Core.Platform.SDK.IBeamableApiRequester
AccessToken Token [getset]
 
- Properties inherited from Beamable.Common.Api.IBeamableRequester
IAccessToken AccessToken [get]
 The IAccessToken the IBeamableRequester will use when making network calls with the Request<T> method.
 

Member Function Documentation

◆ EscapeURL()

string Core.Platform.SDK.BeamableApiRequester.EscapeURL ( string  url)
inline

A utility method that will url escape a string.

Parameters
urla url string
Returns
the given url string, but with character escaping.

Implements Beamable.Common.Api.IBeamableRequester.

◆ Request< T >()

Promise< T > Core.Platform.SDK.BeamableApiRequester.Request< T > ( Method  method,
string  uri,
object  body = null,
bool  includeAuthHeader = true,
Func< string, T >  parser = null,
bool  useCache = false 
)
inline

Make an authorized request to the Beamable API.

Parameters
methodOne of the common HTTP methods represented through the Method enum
uriA Beamable API relative uri. The uri may contain URL parameters.
bodyThe body of the network request. If the type of the body is an object, it will be serialized to JSON. If the type of the body is a string, no serialization will occur.
includeAuthHeaderWhen includeAuthHeader is true, the IAccessToken.Token value will be automatically passed in as the Authorization Header for the request. When the includeAuthHeader is false, no Authorization Header will be sent with the network request.
parserBy default, the network response will be assumed JSON and deserialized as such. However, if a parser is provided, the network response will be given the parser as a string. The parser can convert the string into the expected result type, T
useCacheWhen useCache is enabled, the network response will be written to disk and indexed by the uri, method, and includeAuthHeader. If the same request is sent later when the player is offline, the disk value will be read and given as a valid response.
Template Parameters
TThe type of the network response. The network response will be deserialized into an instance of T. You can override the parsing by passing a custom parser
Returns
A Promise<T> of type T when the network request completes.

Implements Beamable.Common.Api.IBeamableRequester.

◆ WithAccessToken()

IBeamableRequester Core.Platform.SDK.BeamableApiRequester.WithAccessToken ( TokenResponse  tokenResponse)
inline

Create a new IBeamableRequester that will authenticate all requests using the given TokenResponse argument. WARNING, this method is not supported inside Microservices.

Parameters
tokenResponseA TokenResponse that will be used to create the AccessToken for the resulting requester.
Returns
A new IBeamableRequester

Implements Beamable.Common.Api.IBeamableRequester.


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