Skip to main content

GetProductActionsAsync

Gets the list of available product actions that can be taken against players. This method is only available to dev players.

Method Signature

public async Task<ProductActionsResponse> GetProductActionsAsync()

Parameters

This method takes no parameters.

Returns

Returns a ProductActionsResponse object containing the list of available product actions, or null if the request failed or the caller is not a dev player.

Usage Example

var actionsResponse = await PlaySafeManager.Instance.GetProductActionsAsync();

if (actionsResponse != null && actionsResponse.Ok && actionsResponse.Data != null)
{
foreach (var action in actionsResponse.Data)
{
Debug.Log($"Action: {action.Name} (ID: {action.Id}, Permanent: {action.IsPermanent})");
}
}

Response Type

ProductActionsResponse

public class ProductActionsResponse
{
public bool Ok { get; set; }
public List<ProductActionData> Data { get; set; }
public string Message { get; set; }
}

ProductActionData

public class ProductActionData
{
public string Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public string Value { get; set; }
public bool IsPermanent { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime UpdatedAt { get; set; }
}

Properties

PropertyTypeDescription
OkboolIndicates whether the request was successful
DataList<ProductActionData>The list of available product actions
Data[].IdstringThe unique ID of the product action
Data[].NamestringThe display name of the action (e.g. "Temp Voice Ban")
Data[].DescriptionstringA description of what the action does
Data[].ValuestringThe machine-readable action value (e.g. "temp_voice_ban")
Data[].IsPermanentboolWhether the action is permanent
MessagestringResponse message from the server

Error Handling

The method returns null if:

  • The current player is not a dev player
  • Network request fails
  • Response parsing fails

Always check for null and verify the Ok property before accessing the data.

Notes

  • This method is only available to dev players. Non-dev players will receive a warning and the method will return null.
  • Use the Id from the returned product actions when calling TakeManualActionOnPlayerAsync().
  • Product actions are configured in the PlaySafe dashboard.