@@ -103,6 +103,12 @@ public class LootLockerAppleSessionResponse : LootLockerSessionResponse
103103 public string refresh_token { get ; set ; }
104104 }
105105
106+ [ System . Serializable ]
107+ public class LootLockerEpicSessionResponse : LootLockerSessionResponse
108+ {
109+ public string refresh_token { get ; set ; }
110+ }
111+
106112 [ System . Serializable ]
107113 public class LootLockerLevel_Thresholds
108114 {
@@ -125,6 +131,32 @@ public LootLockerNintendoSwitchSessionRequest(string nsa_id_token)
125131 }
126132 }
127133
134+ [ System . Serializable ]
135+ public class LootLockerEpicSessionRequest : LootLockerGetRequest
136+ {
137+ public string game_key => LootLockerConfig . current . apiKey ? . ToString ( ) ;
138+ public string id_token { get ; private set ; }
139+ public string game_version => LootLockerConfig . current . game_version ;
140+
141+ public LootLockerEpicSessionRequest ( string id_token )
142+ {
143+ this . id_token = id_token ;
144+ }
145+ }
146+
147+ [ System . Serializable ]
148+ public class LootLockerEpicRefreshSessionRequest : LootLockerGetRequest
149+ {
150+ public string game_key => LootLockerConfig . current . apiKey ? . ToString ( ) ;
151+ public string refresh_token { get ; private set ; }
152+ public string game_version => LootLockerConfig . current . game_version ;
153+
154+ public LootLockerEpicRefreshSessionRequest ( string refresh_token )
155+ {
156+ this . refresh_token = refresh_token ;
157+ }
158+ }
159+
128160 public class LootLockerXboxOneSessionRequest : LootLockerGetRequest
129161 {
130162 public string game_key => LootLockerConfig . current . apiKey ? . ToString ( ) ;
@@ -310,13 +342,51 @@ public static void NintendoSwitchSession(LootLockerNintendoSwitchSessionRequest
310342 LootLockerConfig . AddDevelopmentModeFieldToJsonStringIfNeeded ( ref json ) ; // TODO: Deprecated, remove in version 1.2.0
311343 LootLockerServerRequest . CallAPI ( endPoint . endPoint , endPoint . httpMethod , json , ( serverResponse ) =>
312344 {
313- var response = LootLockerResponse . Deserialize < LootLockerGuestSessionResponse > ( serverResponse ) ;
345+ var response = LootLockerResponse . Deserialize < LootLockerSessionResponse > ( serverResponse ) ;
314346 LootLockerConfig . current . token = response . session_token ;
315347 LootLockerConfig . current . deviceID = "" ;
316348 onComplete ? . Invoke ( response ) ;
317349 } , false ) ;
318350 }
319351
352+ public static void EpicSession ( LootLockerEpicSessionRequest data , Action < LootLockerEpicSessionResponse > onComplete )
353+ {
354+ if ( data == null )
355+ {
356+ onComplete ? . Invoke ( LootLockerResponseFactory . InputUnserializableError < LootLockerEpicSessionResponse > ( ) ) ;
357+ return ;
358+ }
359+
360+ string json = JsonConvert . SerializeObject ( data ) ;
361+ EpicSession ( json , onComplete ) ;
362+ }
363+
364+ public static void EpicSession ( LootLockerEpicRefreshSessionRequest data , Action < LootLockerEpicSessionResponse > onComplete )
365+ {
366+ if ( data == null )
367+ {
368+ onComplete ? . Invoke ( LootLockerResponseFactory . InputUnserializableError < LootLockerEpicSessionResponse > ( ) ) ;
369+ return ;
370+ }
371+
372+ string json = JsonConvert . SerializeObject ( data ) ;
373+ EpicSession ( json , onComplete ) ;
374+ }
375+
376+ private static void EpicSession ( string json , Action < LootLockerEpicSessionResponse > onComplete )
377+ {
378+ EndPointClass endPoint = LootLockerEndPoints . epicSessionRequest ;
379+ LootLockerConfig . AddDevelopmentModeFieldToJsonStringIfNeeded ( ref json ) ; // TODO: Deprecated, remove in version 1.2.0
380+ LootLockerServerRequest . CallAPI ( endPoint . endPoint , endPoint . httpMethod , json , ( serverResponse ) =>
381+ {
382+ var response = LootLockerResponse . Deserialize < LootLockerEpicSessionResponse > ( serverResponse ) ;
383+ LootLockerConfig . current . token = response . session_token ;
384+ LootLockerConfig . current . refreshToken = response . refresh_token ;
385+ LootLockerConfig . current . deviceID = "" ;
386+ onComplete ? . Invoke ( response ) ;
387+ } , false ) ;
388+ }
389+
320390 public static void XboxOneSession ( LootLockerXboxOneSessionRequest data , Action < LootLockerSessionResponse > onComplete )
321391 {
322392 EndPointClass endPoint = LootLockerEndPoints . xboxSessionRequest ;
0 commit comments