Skip to content

Commit ef16bd5

Browse files
Add additional overloads for UploadFile and CallAPI methods
1 parent cea1bee commit ef16bd5

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Runtime/Client/LootLockerServerRequest.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,12 @@ public static void CallAPI(string endPoint, LootLockerHTTPMethod httpMethod, str
183183

184184
new LootLockerServerRequest(endPoint, httpMethod, body, headers, callerRole: callerRole).Send((response) => { onComplete?.Invoke(response); });
185185
}
186+
187+
public static void CallAPI(EndPointClass endpoint, string body = null, Action<LootLockerResponse> onComplete = null, bool useAuthToken = true,
188+
LootLocker.LootLockerEnums.LootLockerCallerRole callerRole = LootLocker.LootLockerEnums.LootLockerCallerRole.User)
189+
{
190+
CallAPI(endpoint.endPoint, endpoint.httpMethod, body, onComplete: (serverResponse) => { LootLockerResponse.Serialize(onComplete, serverResponse); }, useAuthToken, callerRole);
191+
}
186192

187193
public static void CallDomainAuthAPI(string endPoint, LootLockerHTTPMethod httpMethod, string body = null, Action<LootLockerResponse> onComplete = null)
188194
{
@@ -225,6 +231,12 @@ public static void UploadFile(string endPoint, LootLockerHTTPMethod httpMethod,
225231

226232
new LootLockerServerRequest(endPoint, httpMethod, file, fileName, fileContentType, body, headers, callerRole: callerRole).Send((response) => { onComplete?.Invoke(response); });
227233
}
234+
235+
public static void UploadFile(EndPointClass endPoint, byte[] file, string fileName = "file", string fileContentType = "text/plain", Dictionary<string, string> body = null, Action<LootLockerResponse> onComplete = null,
236+
bool useAuthToken = true, LootLocker.LootLockerEnums.LootLockerCallerRole callerRole = LootLocker.LootLockerEnums.LootLockerCallerRole.User)
237+
{
238+
UploadFile(endPoint.endPoint, endPoint.httpMethod, file, fileName, fileContentType, body, onComplete: (serverResponse) => { LootLockerResponse.Serialize(onComplete, serverResponse); }, useAuthToken, callerRole);
239+
}
228240

229241
#endregion
230242

0 commit comments

Comments
 (0)