API Integration
Sequence API
After you've completed initial authentication and have intercepted the credentials either through your UI or ours, to use the Sequence API you'll need to create a [USequenceWallet]
by using:
`[USequenceWallet * Api = USequenceWallet(CredentialsIn)]` or `[USequenceWallet * Api = USequenceWallet::Make(CredentialsIn, ProviderURL)]`
Once you have your [USequenceWallet]
UObject call [Api>RegisterSession(OnSuccess,GenericFailure)]
this will register your credentials with the Sequence API. Note not calling Register prior to make any others calls will result in errors as a UserWallet hasn't been supplied until this point.
`*
Assuming you've setup your controlling Actor with the [Sequence_Pawn_Component_BP]
The sequence pawn component has functions to do the following:
Setup Sequence (sets up the sequence based systems), requires playerController input
Show GUI Shows the UI
Hide GUI Hides the UI
GUI Visible Simple Visibility test for the UI
Switch Platform (Switches which mode the UI will be in and how it will be displayed)
Note: this doesn't rotate the application into any one view it just make the UI responsive to that type of view.
Modes:
- Desktop (default)
- Mobile Portrait (Custom built for portrait mode reducing the X width where ever possible)
- Mobile Landscape
`*
Sequence Unreal API
The Sequence Unreal plugin is broken up into a few different parts in order to manage all of the differing functionality. Here we'll go through each parts purpose then summarize how to use them all together below
The SDK automatically stores credentials on disk in the following cases:
- On Successful Auth
- On Successful Registering of a session
- On Successful Closing of a session
USequenceWallet
To get a USequenceWallet
call either:
USequenceWallet::Make(FCredentials_BE CredentialsIn)
USequenceWallet::Make(FCredentials_BE CredentialsIn, FString ProviderURL)
Where the Credentials you give are the credentials you received from the UAuthenticator when [AuthSuccess]
fires, or you can use the call Auth->[GetStoredCredentials]
(), where Auth is of the type [UAuthenticator]
. If you are using StoredCredentials please ensure they are valid by checking the wrapping Structs FStoredCredentials_BE.GetValid() flag returned from [GetStoredCredentials]
, the providerURL is the url of the provider you wish to use.
Once you have your [USequenceWallet]
UObject please ensure that you've registered the session using [RegisterSession]
before attempting to make other calls to the API.
Sequence API Methods
We make use of TFunctions with some callbacks:
TSuccessCallback
const TFunction<void(FString)> OnResponse = `[Capturable variables]`(const FString& Response)
{
//callback body where we can process Response
};
FFailureCallback
const TFunction<void(FSequenceError)> OnFailureTest = `[Capturable variables]`(const FSequenceError& Error)
{
//callback body where we can process Error
};
One thing to be aware of is keep an eye on capturables if you have lots of nested TFunctions it's very easy to miss something and start over writing memory. If you require lots of nesting swapping to a better approach using UFUNCTION callbacks helps to avoid these problems similar to how things are done in [UAuthenticator.h/cpp]