Inheritance: IGitterApiService
Beispiel #1
0
        private static GitterChatMessageResult PostToChatApi(this ICakeContext context, string message, GitterChatMessageSettings messageSettings)
        {
            if (string.IsNullOrWhiteSpace(messageSettings.Token))
            {
                throw new NullReferenceException("No authorization token provided.");
            }

            var gitterApiService = new GitterApiService(messageSettings.Token);
            var messageResponse = gitterApiService.SendMessageAsync(messageSettings.RoomId, message);

            var parsedResult = new GitterChatMessageResult(!string.IsNullOrWhiteSpace(messageResponse.Result.Id), messageResponse.Result.SentDate.ToString("u"), string.Empty);

            context.Debug("Result parsed: {0}", parsedResult);

            return parsedResult;
        }