public bool SendNotification(int roomId, SendRoomNotificationRequest request) { return SendNotification(roomId.ToString(), request); }
public bool SendNotification(string roomName, SendRoomNotificationRequest request) { using (JsonSerializerConfigScope()) { if (request.Message.IsEmpty() || request.Message.Length > 10000) throw new ArgumentOutOfRangeException("request", "message length must be between 0 and 10k characters"); var result = false; try { HipchatEndpoints.SendNotificationEndpointFormat .Fmt(roomName) .AddHipchatAuthentication(_authToken) .PostJsonToUrl(request, null, x => { if (x.StatusCode == HttpStatusCode.NoContent) result = true; }); } catch (Exception exception) { if (exception is WebException) throw ExceptionHelpers.WebExceptionHelper(exception as WebException, "send_notification"); throw ExceptionHelpers.GeneralExceptionHelper(exception, "SendNotification"); } return result; } }
public bool SendNotification(string roomName, string message, RoomColors backgroundColor = RoomColors.Yellow, bool notify = false, HipchatMessageFormat messageFormat = HipchatMessageFormat.Html) { using (JsonSerializerConfigScope()) { var request = new SendRoomNotificationRequest { Color = backgroundColor, Message = message, MessageFormat = messageFormat, Notify = notify }; return SendNotification(roomName, request); } }