/// <summary>
        /// Initialises a new instance of the request with the given description.
        /// </summary>
        ///
        /// <param name="desc">The description.</param>
        /// <param name="connectAccessToken">A valid session ConnectAccessToken obtained through one of the login endpoints.</param>
        public GetPlayerDataForChilliConnectIdsRequest(GetPlayerDataForChilliConnectIdsRequestDesc desc, string connectAccessToken)
        {
            ReleaseAssert.IsNotNull(desc, "A description object cannot be null.");

            ReleaseAssert.IsNotNull(desc.Key, "Key cannot be null.");
            ReleaseAssert.IsNotNull(desc.ChilliConnectIDs, "ChilliConnectIDs cannot be null.");

            ReleaseAssert.IsNotNull(connectAccessToken, "Connect Access Token cannot be null.");

            Key = desc.Key;
            ChilliConnectIDs   = Mutability.ToImmutable(desc.ChilliConnectIDs);
            IncludeMe          = desc.IncludeMe;
            ConnectAccessToken = connectAccessToken;

            Url = "https://connect.chilliconnect.com/1.0/data/player/get/chilli";
            HttpRequestMethod = HttpRequestMethod.Post;
        }
예제 #2
0
        /// <summary>
        /// Returns the value of a specified Custom Data Key for a list of provided
        /// ChilliConnectIDs.
        /// </summary>
        ///
        /// <param name="desc">The request description.</param>
        /// <param name="successCallback">The delegate which is called if the request was successful.</param>
        /// <param name="errorCallback">The delegate which is called if the request was unsuccessful. Provides
        /// a container with information on what went wrong.</param>
        public void GetPlayerDataForChilliConnectIds(GetPlayerDataForChilliConnectIdsRequestDesc desc, Action <GetPlayerDataForChilliConnectIdsRequest, GetPlayerDataForChilliConnectIdsResponse> successCallback, Action <GetPlayerDataForChilliConnectIdsRequest, GetPlayerDataForChilliConnectIdsError> errorCallback)
        {
            m_logging.LogVerboseMessage("Sending Get Player Data For Chilli Connect Ids request.");

            var connectAccessToken = m_dataStore.GetString("UserAccessToken");
            var request            = new GetPlayerDataForChilliConnectIdsRequest(desc, connectAccessToken);

            m_serverRequestSystem.SendImmediateRequest(request, (IImmediateServerRequest sentRequest, ServerResponse serverResponse) =>
            {
                ReleaseAssert.IsTrue(request == sentRequest, "Received request is not the same as the one sent!");

                if (serverResponse.Result == HttpResult.Success && serverResponse.HttpResponseCode == SuccessHttpResponseCode)
                {
                    NotifyGetPlayerDataForChilliConnectIdsSuccess(serverResponse, request, successCallback);
                }
                else
                {
                    NotifyGetPlayerDataForChilliConnectIdsError(serverResponse, request, errorCallback);
                }
            });
        }