-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
Release 0.18.0
- Loading branch information
There are no files selected for viewing
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using UnityEngine; | ||
using TaloGameServices; | ||
using System.Threading.Tasks; | ||
using System.Linq; | ||
|
||
public class GetCategories : MonoBehaviour | ||
{ | ||
public async void OnButtonClick() | ||
{ | ||
await FetchCategories(); | ||
} | ||
|
||
private async Task FetchCategories() | ||
{ | ||
var categories = await Talo.Feedback.GetCategories(); | ||
|
||
if (categories.Length == 0) | ||
{ | ||
ResponseMessage.SetText("No categories found. Create some in the Talo dashboard!"); | ||
} | ||
else | ||
{ | ||
var mapped = categories.Select((c) => $"{c.name} ({c.internalName})"); | ||
ResponseMessage.SetText($"Categories: " + string.Join(',', mapped)); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using UnityEngine; | ||
using TaloGameServices; | ||
|
||
public class SendFeedback : MonoBehaviour | ||
{ | ||
public string internalName, feedbackComment; | ||
|
||
public async void OnButtonClick() | ||
{ | ||
await Talo.Feedback.Send(internalName, feedbackComment); | ||
ResponseMessage.SetText($"Feedback sent for {internalName}: {feedbackComment}"); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System; | ||
|
||
namespace TaloGameServices | ||
{ | ||
[Serializable] | ||
public class FeedbackCategory | ||
{ | ||
public int id; | ||
public string internalName; | ||
public string name; | ||
public string description; | ||
public bool anonymised; | ||
public string createdAt; | ||
public string updatedAt; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using UnityEngine; | ||
|
||
namespace TaloGameServices | ||
{ | ||
public class FeedbackAPI : BaseAPI | ||
{ | ||
public FeedbackAPI(TaloManager manager) : base(manager, "/v1/game-feedback") { } | ||
|
||
public async Task<FeedbackCategory[]> GetCategories() | ||
{ | ||
var uri = new Uri(baseUrl + "/categories"); | ||
|
||
var json = await Call(uri, "GET"); | ||
var res = JsonUtility.FromJson<FeedbackCategoriesResponse>(json); | ||
return res.feedbackCategories; | ||
} | ||
|
||
public async Task Send(string internalName, string comment) | ||
{ | ||
Talo.IdentityCheck(); | ||
|
||
var uri = new Uri(baseUrl + $"/categories/{internalName}"); | ||
var content = JsonUtility.ToJson(new FeedbackPostRequest() { comment = comment }); | ||
|
||
await Call(uri, "POST", content); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace TaloGameServices | ||
{ | ||
public class FeedbackPostRequest | ||
{ | ||
public string comment; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace TaloGameServices | ||
{ | ||
[System.Serializable] | ||
public class FeedbackCategoriesResponse | ||
{ | ||
public FeedbackCategory[] feedbackCategories; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.