Skip to content

Commit 3c95711

Browse files
AlmightyMikkelkirre-bylund
authored andcommitted
Updated feedback with new backend changes
1 parent f15fc96 commit 3c95711

File tree

2 files changed

+101
-41
lines changed

2 files changed

+101
-41
lines changed

Runtime/Game/LootLockerSDKManager.cs

Lines changed: 65 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5352,6 +5352,11 @@ public static void GetRemovedUGCForPlayer(GetRemovedUGCForPlayerInput input, Act
53525352

53535353
#region Feedback
53545354

5355+
/// <summary>
5356+
/// Returns a list of categories to be used for giving feedback.
5357+
/// </summary>
5358+
/// <param name="type">Type of feedback (player, game, ugc)</param>
5359+
/// <param name="onComplete">onComplete Action for handling the response of type ListLootLockerFeedbackCategoryResponse</param>
53555360
public static void ListFeedbackCategories(LootLockerFeedbackTypes type, Action<ListLootLockerFeedbackCategoryResponse> onComplete)
53565361
{
53575362
if (!CheckInitialized())
@@ -5364,11 +5369,45 @@ public static void ListFeedbackCategories(LootLockerFeedbackTypes type, Action<L
53645369

53655370
var formattedEndPoint = string.Format(endPoint.endPoint, type.ToString());
53665371

5367-
53685372
LootLockerServerRequest.CallAPI(formattedEndPoint, endPoint.httpMethod, onComplete: (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
5373+
}
5374+
53695375

5376+
/// <summary>
5377+
/// Returns a list of categories to be used for giving feedback about a certain player.
5378+
/// </summary>
5379+
/// <param name="onComplete">onComplete Action for handling the response of type ListLootLockerFeedbackCategoryResponse</param>
5380+
public static void ListPlayerFeedbackCategories(Action<ListLootLockerFeedbackCategoryResponse> onComplete)
5381+
{
5382+
ListFeedbackCategories(LootLockerFeedbackTypes.player, onComplete);
5383+
}
5384+
5385+
/// <summary>
5386+
/// Returns a list of categories to be used for giving feedback about the game.
5387+
/// </summary>
5388+
/// <param name="onComplete">onComplete Action for handling the response of type ListLootLockerFeedbackCategoryResponse</param>
5389+
public static void ListGameFeedbackCategories(Action<ListLootLockerFeedbackCategoryResponse> onComplete)
5390+
{
5391+
ListFeedbackCategories(LootLockerFeedbackTypes.game, onComplete);
5392+
}
5393+
5394+
/// <summary>
5395+
/// Returns a list of categories to be used for giving feedback about a certain ugc asset.
5396+
/// </summary>
5397+
/// <param name="onComplete">onComplete Action for handling the response of type ListLootLockerFeedbackCategoryResponse</param>
5398+
public static void ListUgcFeedbackCategories(Action<ListLootLockerFeedbackCategoryResponse> onComplete)
5399+
{
5400+
ListFeedbackCategories(LootLockerFeedbackTypes.ugc, onComplete);
53705401
}
53715402

5403+
/// <summary>
5404+
/// Sends a feedback with the given data, will return 204 upon successful request.
5405+
/// </summary>
5406+
/// <param name="type">Type of feedback (player, game, ugc)</param>
5407+
/// <param name="ulid">Ulid of what you're giving feedback about</param>
5408+
/// <param name="description">Reason behind the report</param>
5409+
/// <param name="category_id">A unique identifier of what catagory the report should belong under</param>
5410+
/// <param name="onComplete">onComplete Action for handling the response of type LootLockerResponse</param>
53725411
public static void SendFeedback(LootLockerFeedbackTypes type, string ulid, string description, string category_id, Action<LootLockerResponse> onComplete)
53735412
{
53745413
if (!CheckInitialized())
@@ -5391,30 +5430,25 @@ public static void SendFeedback(LootLockerFeedbackTypes type, string ulid, strin
53915430
LootLockerServerRequest.CallAPI(endPoint.endPoint, endPoint.httpMethod, json, onComplete: (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
53925431
}
53935432

5394-
5433+
/// <summary>
5434+
/// Sends a feedback with the given data, will return 204 upon successful request.
5435+
/// </summary>
5436+
/// <param name="ulid">Ulid of who you're giving feedback about</param>
5437+
/// <param name="description">Reason behind the report</param>
5438+
/// <param name="category_id">A unique identifier of what catagory the report should belong under</param>
5439+
/// <param name="onComplete">onComplete Action for handling the response of type LootLockerResponse</param>
53955440
public static void SendPlayerFeedback(string ulid, string description, string category_id, Action<LootLockerResponse> onComplete)
53965441
{
5397-
if (!CheckInitialized())
5398-
{
5399-
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerResponse>());
5400-
return;
5401-
}
5402-
EndPointClass endPoint = LootLockerEndPoints.createFeedbackEntry;
5403-
5404-
var request = new LootLockerFeedbackRequest
5405-
{
5406-
entity = LootLockerFeedbackTypes.player.ToString(),
5407-
entity_id = ulid,
5408-
description = description,
5409-
category_id = category_id
5410-
};
5411-
5412-
string json = LootLockerJson.SerializeObject(request);
5413-
5414-
LootLockerServerRequest.CallAPI(endPoint.endPoint, endPoint.httpMethod, json, onComplete: (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
5442+
SendFeedback(LootLockerFeedbackTypes.player, ulid, description, category_id, onComplete);
54155443
}
54165444

5417-
public static void SendGameFeedback(string ulid, string description, string category_id, Action<LootLockerResponse> onComplete)
5445+
/// <summary>
5446+
/// Sends a feedback with the given data, will return 204 upon successful request.
5447+
/// </summary>
5448+
/// <param name="description">Reason behind the report</param>
5449+
/// <param name="category_id">A unique identifier of what catagory the report should belong under</param>
5450+
/// <param name="onComplete">onComplete Action for handling the response of type LootLockerResponse</param>
5451+
public static void SendGameFeedback(string description, string category_id, Action<LootLockerResponse> onComplete)
54185452
{
54195453
if (!CheckInitialized())
54205454
{
@@ -5426,7 +5460,6 @@ public static void SendGameFeedback(string ulid, string description, string cate
54265460
var request = new LootLockerFeedbackRequest
54275461
{
54285462
entity = LootLockerFeedbackTypes.game.ToString(),
5429-
entity_id = ulid,
54305463
description = description,
54315464
category_id = category_id
54325465
};
@@ -5435,26 +5468,18 @@ public static void SendGameFeedback(string ulid, string description, string cate
54355468

54365469
LootLockerServerRequest.CallAPI(endPoint.endPoint, endPoint.httpMethod, json, onComplete: (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
54375470
}
5471+
}
5472+
5473+
/// <summary>
5474+
/// Sends a feedback with the given data, will return 204 upon successful request.
5475+
/// </summary>
5476+
/// <param name="ulid">Ulid of which asset you're giving feedback about</param>
5477+
/// <param name="description">Reason behind the report</param>
5478+
/// <param name="category_id">A unique identifier of what catagory the report should belong under</param>
5479+
/// <param name="onComplete">onComplete Action for handling the response of type LootLockerResponse</param>
54385480
public static void SendUGCFeedback(string ulid, string description, string category_id, Action<LootLockerResponse> onComplete)
54395481
{
5440-
if (!CheckInitialized())
5441-
{
5442-
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerResponse>());
5443-
return;
5444-
}
5445-
EndPointClass endPoint = LootLockerEndPoints.createFeedbackEntry;
5446-
5447-
var request = new LootLockerFeedbackRequest
5448-
{
5449-
entity = LootLockerFeedbackTypes.ugc.ToString(),
5450-
entity_id = ulid,
5451-
description = description,
5452-
category_id = category_id
5453-
};
5454-
5455-
string json = LootLockerJson.SerializeObject(request);
5456-
5457-
LootLockerServerRequest.CallAPI(endPoint.endPoint, endPoint.httpMethod, json, onComplete: (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
5482+
SendFeedback(LootLockerFeedbackTypes.ugc, ulid, description, category_id, onComplete);
54585483
}
54595484

54605485
#endregion

Runtime/Game/Requests/FeedbackRequests.cs

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33

44
namespace LootLocker.Requests
55
{
6-
6+
/// <summary>
7+
/// Enum with the supported feedback types that are avaliable for feedback
8+
/// </summary>
79
public enum LootLockerFeedbackTypes
810
{
911
player = 0,
@@ -14,23 +16,56 @@ public enum LootLockerFeedbackTypes
1416

1517
public class ListLootLockerFeedbackCategoryResponse : LootLockerResponse
1618
{
19+
/// <summary>
20+
/// A list of categories made for the game
21+
/// </summary>
1722
public LootLockerFeedbackCategory[] categories { get; set; }
1823
}
1924

2025
public class LootLockerFeedbackCategory
2126
{
27+
/// <summary>
28+
/// The unique identifier of a feedback category
29+
/// </summary>
2230
public string id { get; set; }
31+
32+
/// <summary>
33+
/// The type of a feedback category (Player, Game, UGC)
34+
/// </summary>
2335
public LootLockerFeedbackTypes entity { get; set; }
36+
37+
/// <summary>
38+
/// The name of a feedback category
39+
/// </summary>
2440
public string name { get; set; }
41+
42+
/// <summary>
43+
/// The description of a feedback category
44+
/// </summary>
2545
public string description { get; set; }
2646
}
2747

2848

2949
public class LootLockerFeedbackRequest
3050
{
51+
/// <summary>
52+
/// A string representation of the type of feedback, use LootLockerFeedbackTypes.x.ToString()
53+
/// </summary>
3154
public string entity { get; set; }
55+
56+
/// <summary>
57+
/// The Ulid of what you're sending feedback about
58+
/// </summary>
3259
public string entity_id { get; set; }
60+
61+
/// <summary>
62+
/// The category id of what kind of feedback you're sending, use ListFeedbackCategories for all the ids
63+
/// </summary>
3364
public string category_id { get; set; }
65+
66+
/// <summary>
67+
/// The description of feedback you're sending, this will be the reason
68+
/// </summary>
3469
public string description { get; set; }
3570
}
3671

0 commit comments

Comments
 (0)