You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
367 lines
22 KiB
C#
367 lines
22 KiB
C#
#if !DISABLE_PLAYFABENTITY_API && !DISABLE_PLAYFAB_STATIC_API
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using PlayFab.GroupsModels;
|
|
using PlayFab.Internal;
|
|
|
|
namespace PlayFab
|
|
{
|
|
/// <summary>
|
|
/// The Groups API is designed for any permanent or semi-permanent collections of Entities (players, or non-players). If you
|
|
/// want to make Guilds/Clans/Corporations/etc., then you should use groups. Groups can also be used to make chatrooms,
|
|
/// parties, or any other persistent collection of entities.
|
|
/// </summary>
|
|
public static class PlayFabGroupsAPI
|
|
{
|
|
static PlayFabGroupsAPI() {}
|
|
|
|
|
|
/// <summary>
|
|
/// Verify entity login.
|
|
/// </summary>
|
|
public static bool IsEntityLoggedIn()
|
|
{
|
|
return PlayFabSettings.staticPlayer.IsEntityLoggedIn();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Clear the Client SessionToken which allows this Client to call API calls requiring login.
|
|
/// A new/fresh login will be required after calling this.
|
|
/// </summary>
|
|
public static void ForgetAllCredentials()
|
|
{
|
|
PlayFabSettings.staticPlayer.ForgetAllCredentials();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Accepts an outstanding invitation to to join a group
|
|
/// </summary>
|
|
public static void AcceptGroupApplication(AcceptGroupApplicationRequest request, Action<EmptyResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
|
|
{
|
|
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
|
|
var callSettings = PlayFabSettings.staticSettings;
|
|
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
|
|
|
|
|
|
PlayFabHttp.MakeApiCall("/Group/AcceptGroupApplication", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Accepts an invitation to join a group
|
|
/// </summary>
|
|
public static void AcceptGroupInvitation(AcceptGroupInvitationRequest request, Action<EmptyResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
|
|
{
|
|
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
|
|
var callSettings = PlayFabSettings.staticSettings;
|
|
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
|
|
|
|
|
|
PlayFabHttp.MakeApiCall("/Group/AcceptGroupInvitation", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Adds members to a group or role.
|
|
/// </summary>
|
|
public static void AddMembers(AddMembersRequest request, Action<EmptyResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
|
|
{
|
|
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
|
|
var callSettings = PlayFabSettings.staticSettings;
|
|
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
|
|
|
|
|
|
PlayFabHttp.MakeApiCall("/Group/AddMembers", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Applies to join a group
|
|
/// </summary>
|
|
public static void ApplyToGroup(ApplyToGroupRequest request, Action<ApplyToGroupResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
|
|
{
|
|
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
|
|
var callSettings = PlayFabSettings.staticSettings;
|
|
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
|
|
|
|
|
|
PlayFabHttp.MakeApiCall("/Group/ApplyToGroup", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Blocks a list of entities from joining a group.
|
|
/// </summary>
|
|
public static void BlockEntity(BlockEntityRequest request, Action<EmptyResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
|
|
{
|
|
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
|
|
var callSettings = PlayFabSettings.staticSettings;
|
|
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
|
|
|
|
|
|
PlayFabHttp.MakeApiCall("/Group/BlockEntity", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Changes the role membership of a list of entities from one role to another.
|
|
/// </summary>
|
|
public static void ChangeMemberRole(ChangeMemberRoleRequest request, Action<EmptyResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
|
|
{
|
|
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
|
|
var callSettings = PlayFabSettings.staticSettings;
|
|
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
|
|
|
|
|
|
PlayFabHttp.MakeApiCall("/Group/ChangeMemberRole", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Creates a new group.
|
|
/// </summary>
|
|
public static void CreateGroup(CreateGroupRequest request, Action<CreateGroupResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
|
|
{
|
|
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
|
|
var callSettings = PlayFabSettings.staticSettings;
|
|
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
|
|
|
|
|
|
PlayFabHttp.MakeApiCall("/Group/CreateGroup", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Creates a new group role.
|
|
/// </summary>
|
|
public static void CreateRole(CreateGroupRoleRequest request, Action<CreateGroupRoleResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
|
|
{
|
|
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
|
|
var callSettings = PlayFabSettings.staticSettings;
|
|
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
|
|
|
|
|
|
PlayFabHttp.MakeApiCall("/Group/CreateRole", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Deletes a group and all roles, invitations, join requests, and blocks associated with it.
|
|
/// </summary>
|
|
public static void DeleteGroup(DeleteGroupRequest request, Action<EmptyResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
|
|
{
|
|
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
|
|
var callSettings = PlayFabSettings.staticSettings;
|
|
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
|
|
|
|
|
|
PlayFabHttp.MakeApiCall("/Group/DeleteGroup", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Deletes an existing role in a group.
|
|
/// </summary>
|
|
public static void DeleteRole(DeleteRoleRequest request, Action<EmptyResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
|
|
{
|
|
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
|
|
var callSettings = PlayFabSettings.staticSettings;
|
|
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
|
|
|
|
|
|
PlayFabHttp.MakeApiCall("/Group/DeleteRole", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets information about a group and its roles
|
|
/// </summary>
|
|
public static void GetGroup(GetGroupRequest request, Action<GetGroupResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
|
|
{
|
|
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
|
|
var callSettings = PlayFabSettings.staticSettings;
|
|
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
|
|
|
|
|
|
PlayFabHttp.MakeApiCall("/Group/GetGroup", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Invites a player to join a group
|
|
/// </summary>
|
|
public static void InviteToGroup(InviteToGroupRequest request, Action<InviteToGroupResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
|
|
{
|
|
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
|
|
var callSettings = PlayFabSettings.staticSettings;
|
|
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
|
|
|
|
|
|
PlayFabHttp.MakeApiCall("/Group/InviteToGroup", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Checks to see if an entity is a member of a group or role within the group
|
|
/// </summary>
|
|
public static void IsMember(IsMemberRequest request, Action<IsMemberResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
|
|
{
|
|
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
|
|
var callSettings = PlayFabSettings.staticSettings;
|
|
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
|
|
|
|
|
|
PlayFabHttp.MakeApiCall("/Group/IsMember", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Lists all outstanding requests to join a group
|
|
/// </summary>
|
|
public static void ListGroupApplications(ListGroupApplicationsRequest request, Action<ListGroupApplicationsResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
|
|
{
|
|
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
|
|
var callSettings = PlayFabSettings.staticSettings;
|
|
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
|
|
|
|
|
|
PlayFabHttp.MakeApiCall("/Group/ListGroupApplications", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Lists all entities blocked from joining a group
|
|
/// </summary>
|
|
public static void ListGroupBlocks(ListGroupBlocksRequest request, Action<ListGroupBlocksResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
|
|
{
|
|
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
|
|
var callSettings = PlayFabSettings.staticSettings;
|
|
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
|
|
|
|
|
|
PlayFabHttp.MakeApiCall("/Group/ListGroupBlocks", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Lists all outstanding invitations for a group
|
|
/// </summary>
|
|
public static void ListGroupInvitations(ListGroupInvitationsRequest request, Action<ListGroupInvitationsResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
|
|
{
|
|
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
|
|
var callSettings = PlayFabSettings.staticSettings;
|
|
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
|
|
|
|
|
|
PlayFabHttp.MakeApiCall("/Group/ListGroupInvitations", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Lists all members for a group
|
|
/// </summary>
|
|
public static void ListGroupMembers(ListGroupMembersRequest request, Action<ListGroupMembersResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
|
|
{
|
|
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
|
|
var callSettings = PlayFabSettings.staticSettings;
|
|
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
|
|
|
|
|
|
PlayFabHttp.MakeApiCall("/Group/ListGroupMembers", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Lists all groups and roles for an entity
|
|
/// </summary>
|
|
public static void ListMembership(ListMembershipRequest request, Action<ListMembershipResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
|
|
{
|
|
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
|
|
var callSettings = PlayFabSettings.staticSettings;
|
|
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
|
|
|
|
|
|
PlayFabHttp.MakeApiCall("/Group/ListMembership", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Lists all outstanding invitations and group applications for an entity
|
|
/// </summary>
|
|
public static void ListMembershipOpportunities(ListMembershipOpportunitiesRequest request, Action<ListMembershipOpportunitiesResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
|
|
{
|
|
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
|
|
var callSettings = PlayFabSettings.staticSettings;
|
|
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
|
|
|
|
|
|
PlayFabHttp.MakeApiCall("/Group/ListMembershipOpportunities", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Removes an application to join a group
|
|
/// </summary>
|
|
public static void RemoveGroupApplication(RemoveGroupApplicationRequest request, Action<EmptyResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
|
|
{
|
|
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
|
|
var callSettings = PlayFabSettings.staticSettings;
|
|
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
|
|
|
|
|
|
PlayFabHttp.MakeApiCall("/Group/RemoveGroupApplication", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Removes an invitation join a group
|
|
/// </summary>
|
|
public static void RemoveGroupInvitation(RemoveGroupInvitationRequest request, Action<EmptyResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
|
|
{
|
|
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
|
|
var callSettings = PlayFabSettings.staticSettings;
|
|
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
|
|
|
|
|
|
PlayFabHttp.MakeApiCall("/Group/RemoveGroupInvitation", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Removes members from a group.
|
|
/// </summary>
|
|
public static void RemoveMembers(RemoveMembersRequest request, Action<EmptyResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
|
|
{
|
|
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
|
|
var callSettings = PlayFabSettings.staticSettings;
|
|
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
|
|
|
|
|
|
PlayFabHttp.MakeApiCall("/Group/RemoveMembers", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Unblocks a list of entities from joining a group
|
|
/// </summary>
|
|
public static void UnblockEntity(UnblockEntityRequest request, Action<EmptyResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
|
|
{
|
|
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
|
|
var callSettings = PlayFabSettings.staticSettings;
|
|
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
|
|
|
|
|
|
PlayFabHttp.MakeApiCall("/Group/UnblockEntity", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Updates non-membership data about a group.
|
|
/// </summary>
|
|
public static void UpdateGroup(UpdateGroupRequest request, Action<UpdateGroupResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
|
|
{
|
|
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
|
|
var callSettings = PlayFabSettings.staticSettings;
|
|
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
|
|
|
|
|
|
PlayFabHttp.MakeApiCall("/Group/UpdateGroup", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Updates metadata about a role.
|
|
/// </summary>
|
|
public static void UpdateRole(UpdateGroupRoleRequest request, Action<UpdateGroupRoleResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
|
|
{
|
|
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
|
|
var callSettings = PlayFabSettings.staticSettings;
|
|
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
|
|
|
|
|
|
PlayFabHttp.MakeApiCall("/Group/UpdateRole", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
#endif
|