/// <summary>
        /// Writes a player-based event into PlayStream.
        /// </summary>
        public static void WritePlayerEvent(WriteClientPlayerEventRequest request, ProcessApiCallback<WriteEventResponse> resultCallback, ErrorCallback errorCallback, object customData = null)
        {
            if (_authKey == null) throw new Exception("Must be logged in to call this method");

            string serializedJson = SimpleJson.SerializeObject(request, Util.ApiSerializerStrategy);
            Action<CallRequestContainer> callback = delegate(CallRequestContainer requestContainer)
            {
                ResultContainer<WriteEventResponse>.HandleResults(requestContainer, resultCallback, errorCallback, null);
            };
            PlayFabHTTP.Post("/Client/WritePlayerEvent", serializedJson, "X-Authorization", _authKey, callback, request, customData);
        }
Пример #2
0
        public void WriteEvent(UUnitTestContext testContext)
        {
            var request = new WriteClientPlayerEventRequest
            {
                EventName = "ForumPostEvent",
                Timestamp = DateTime.UtcNow,
                Body = new Dictionary<string, object>
                {
                    { "Subject", "My First Post" },
                    { "Body", "My awesome Post." }
                }
            };

            PlayFabClientAPI.WritePlayerEvent(request, PlayFabUUnitUtils.ApiCallbackWrapper<WriteEventResponse>(testContext, WriteEventCallback), SharedErrorCallback, testContext);
        }
Пример #3
0
        private void WriteEvent()
        {
            var request = new WriteClientPlayerEventRequest();
            request.EventName = "ForumPostEvent";
            request.Timestamp = DateTime.UtcNow;
            request.Body = new Dictionary<string, object>();
            request.Body["Subject"] = "My First Post";
            request.Body["Body"] = "My awesome post.";

            PlayFabClientAPI.WritePlayerEvent(request, WriteEventCallback, SharedErrorCallback);
            WaitForApiCalls();
            UUnitAssert.StringEquals("WriteEvent posted successfully.", lastReceivedMessage);
        }