public PlayFabLocalizationInstanceAPI(PlayFabApiSettings settings, PlayFabAuthenticationContext context)
 {
     if (context == null)
     {
         throw new PlayFabException(PlayFabExceptionCode.AuthContextRequired, "Context cannot be null, create a PlayFabAuthenticationContext for each player in advance, or call <PlayFabClientInstanceAPI>.GetAuthenticationContext()");
     }
     apiSettings           = settings;
     authenticationContext = context;
 }
 public PlayFabMatchmakerInstanceAPI(PlayFabApiSettings settings, PlayFabAuthenticationContext context)
 {
     if (context == null)
     {
         throw new PlayFabException(PlayFabExceptionCode.AuthContextRequired, "Context cannot be null, create a PlayFabAuthenticationContext for each player in advance, or get <PlayFabClientInstanceAPI>.authenticationContext");
     }
     apiSettings           = settings;
     authenticationContext = context;
 }
Esempio n. 3
0
        public static async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req,
            ILogger log)
        {
            var serverSettings = new PlayFab.PlayFabApiSettings()
            {
                TitleId            = Environment.GetEnvironmentVariable("PlayFab.TitleId", EnvironmentVariableTarget.Process),
                DeveloperSecretKey = Environment.GetEnvironmentVariable("PlayFab.TitleSecret", EnvironmentVariableTarget.Process),
            };

            var authAPI       = new PlayFabAuthenticationInstanceAPI(serverSettings);
            var titleResponse = await authAPI.GetEntityTokenAsync(new PlayFab.AuthenticationModels.GetEntityTokenRequest());

            var title      = titleResponse.Result.Entity;
            var titleToken = titleResponse.Result.EntityToken;

            log.LogInformation($"Title is  : {title.Id}");
            log.LogInformation($"Token is  : {titleToken}");

            var request = new PlayFab.GroupsModels.ListMembershipRequest()
            {
                Entity = new PlayFab.GroupsModels.EntityKey
                {
                    Id   = "7B66887BFE1A76CE",
                    Type = "title_player_account",
                }
            };

            log.LogInformation($"Request is  : {JsonConvert.SerializeObject(request)}");

            var titleAuthContext = new PlayFabAuthenticationContext();

            titleAuthContext.EntityToken = titleToken;

            var api    = new PlayFabGroupsInstanceAPI(serverSettings, titleAuthContext);
            var result = await api.ListMembershipAsync(request);

            //var result = await PlayFabGroupsAPI.ListMembershipAsync(request);

            var groups = result.Result.Groups;
            var msg    = $"group is {JsonConvert.SerializeObject(groups)}\n";

            return((ActionResult) new OkObjectResult($"{msg}"));
        }
 public PlayFabProfilesInstanceAPI(PlayFabApiSettings settings)
 {
     ApiSettings = settings;
 }
Esempio n. 5
0
        public static string GetFullUrl(string apiCall, Dictionary <string, string> getParams, PlayFabApiSettings instanceSettings = null)
        {
            StringBuilder sb = new StringBuilder(1000);

            var apiSettings = instanceSettings ?? staticSettings;

            var baseUrl = apiSettings?.ProductionEnvironmentUrl;

            if (!baseUrl.StartsWith("http"))
            {
                sb.Append("https://");
                if (!string.IsNullOrEmpty(apiSettings?.TitleId))
                {
                    sb.Append(apiSettings.TitleId).Append(".");
                }
                if (!string.IsNullOrEmpty(apiSettings?.VerticalName))
                {
                    sb.Append(apiSettings?.VerticalName).Append(".");
                }
            }

            sb.Append(baseUrl).Append(apiCall);

            if (getParams != null)
            {
                bool firstParam = true;
                foreach (var paramPair in getParams)
                {
                    if (firstParam)
                    {
                        sb.Append("?");
                        firstParam = false;
                    }
                    else
                    {
                        sb.Append("&");
                    }
                    sb.Append(paramPair.Key).Append("=").Append(paramPair.Value);
                }
            }

            return(sb.ToString());
        }
Esempio n. 6
0
 public PlayFabEconomyInstanceAPI(PlayFabApiSettings settings)
 {
     ApiSettings = settings;
 }
 public PlayFabLeaderboardsInstanceAPI(PlayFabApiSettings settings = null, PlayFabAuthenticationContext context = null)
 {
     apiSettings           = settings;
     authenticationContext = context;
 }
 public PlayFabDataInstanceAPI(PlayFabApiSettings settings = null)
 {
     apiSettings = settings;
 }
Esempio n. 9
0
        public static string GetFullUrl(string apiCall, Dictionary <string, string> getParams, PlayFabApiSettings apiSettings = null)
        {
            StringBuilder sb = new StringBuilder(1000);

            string productionEnvironmentUrl = null, verticalName = null, titleId = null;

            if (apiSettings != null)
            {
                if (!string.IsNullOrEmpty(apiSettings.ProductionEnvironmentUrl))
                {
                    productionEnvironmentUrl = apiSettings.ProductionEnvironmentUrl;
                }
                if (!string.IsNullOrEmpty(apiSettings.VerticalName))
                {
                    verticalName = apiSettings.VerticalName;
                }
                if (!string.IsNullOrEmpty(apiSettings.TitleId))
                {
                    titleId = apiSettings.TitleId;
                }
            }
            if (productionEnvironmentUrl == null)
            {
                productionEnvironmentUrl = !string.IsNullOrEmpty(PlayFabSharedPrivate.ProductionEnvironmentUrl) ? PlayFabSharedPrivate.ProductionEnvironmentUrl : DefaultPlayFabApiUrl;
            }
            if (verticalName == null && apiSettings != null && !string.IsNullOrEmpty(apiSettings.VerticalName))
            {
                verticalName = apiSettings.VerticalName;
            }
            if (titleId == null)
            {
                titleId = PlayFabSharedPrivate.TitleId;
            }

            var baseUrl = productionEnvironmentUrl;

            if (!baseUrl.StartsWith("http"))
            {
                sb.Append("https://");
                if (!string.IsNullOrEmpty(titleId))
                {
                    sb.Append(titleId).Append(".");
                }
                if (!string.IsNullOrEmpty(verticalName))
                {
                    sb.Append(verticalName).Append(".");
                }
            }

            sb.Append(baseUrl).Append(apiCall);

            if (getParams != null)
            {
                bool firstParam = true;
                foreach (var paramPair in getParams)
                {
                    if (firstParam)
                    {
                        sb.Append("?");
                        firstParam = false;
                    }
                    else
                    {
                        sb.Append("&");
                    }
                    sb.Append(paramPair.Key).Append("=").Append(paramPair.Value);
                }
            }

            return(sb.ToString());
        }
 public PlayFabCloudScriptInstanceAPI(PlayFabApiSettings settings)
 {
     apiSettings = settings;
 }
Esempio n. 11
0
 public PlayFabMultiplayerInstanceAPI(PlayFabApiSettings settings)
 {
     apiSettings = settings;
 }
 public PlayFabGroupsInstanceAPI(PlayFabApiSettings settings)
 {
     apiSettings = settings;
 }
 public PlayFabAuthenticationInstanceAPI(PlayFabApiSettings settings, PlayFabAuthenticationContext context)
 {
     apiSettings           = settings;
     authenticationContext = context ?? new PlayFabAuthenticationContext();
 }
Esempio n. 14
0
 public PlayFabMultiplayerInstanceAPI(PlayFabApiSettings settings = null, PlayFabAuthenticationContext context = null)
 {
     apiSettings           = settings;
     authenticationContext = context;
 }
 public PlayFabProfilesInstanceAPI(PlayFabApiSettings settings, PlayFabAuthenticationContext context)
 {
     ApiSettings           = settings;
     authenticationContext = context;
 }
Esempio n. 16
0
 public PlayFabEventsInstanceAPI(PlayFabApiSettings settings)
 {
     apiSettings = settings;
 }
 public PlayFabMatchmakerInstanceAPI(PlayFabApiSettings settings)
 {
     apiSettings = settings;
 }
 public PlayFabCloudScriptInstanceAPI(PlayFabApiSettings settings, PlayFabAuthenticationContext context)
 {
     apiSettings           = settings;
     authenticationContext = context;
 }
 public PlayFabMatchmakerInstanceAPI(PlayFabApiSettings settings, PlayFabAuthenticationContext context)
 {
     apiSettings           = settings;
     authenticationContext = context;
 }
 public PlayFabAuthenticationInstanceAPI(PlayFabApiSettings settings = null)
 {
     apiSettings = settings;
 }
 public PlayFabLocalizationInstanceAPI(PlayFabApiSettings settings = null)
 {
     apiSettings = settings;
 }
 public PlayFabLeaderboardsInstanceAPI(PlayFabApiSettings settings = null)
 {
     apiSettings = settings;
 }
 public PlayFabLocalizationInstanceAPI(PlayFabApiSettings settings = null, PlayFabAuthenticationContext context = null)
 {
     apiSettings           = settings;
     authenticationContext = context;
 }
 public void SetSettings(PlayFabApiSettings settings)
 {
     apiSettings = settings;
 }
Esempio n. 25
0
 public PlayFabDataInstanceAPI(PlayFabApiSettings settings)
 {
     ApiSettings = settings;
 }