Example #1
0
 public CreateWebHookResponse CreateWebHook(string roomName, string url, string pattern, RoomEvent eventType, string name)
 {
     using (JsonSerializerConfigScope())
     {
         var request = new CreateWebHookRequest
         {
             Event = eventType,
             Pattern = pattern,
             Url = url,
             Name = name
         };
         return CreateWebHook(roomName, request);
     }
 }
Example #2
0
        public CreateWebHookResponse CreateWebHook(string roomName, CreateWebHookRequest request)
        {
            using (JsonSerializerConfigScope())
            {
                try
                {
                    return HipchatEndpoints.CreateWebhookEndpointFormat.Fmt(roomName)
                        .AddHipchatAuthentication(_authToken)
                        .PostJsonToUrl(request)
                        .FromJson<CreateWebHookResponse>();
                }
                catch (Exception exception)
                {
                    if (exception is WebException)
                        throw ExceptionHelpers.WebExceptionHelper(exception as WebException, "admin_room");

                    throw ExceptionHelpers.GeneralExceptionHelper(exception, "CreateWebHook");
                }
            }
        }
Example #3
0
 public CreateWebHookResponse CreateWebHook(int roomId, string url, string pattern, RoomEvent eventType, string name)
 {
     using (JsonSerializerConfigScope())
     {
         var request = new CreateWebHookRequest
         {
             Event = eventType,
             Pattern = pattern,
             Url = url,
             Name = name
         };
         return CreateWebHook(roomId.ToString(CultureInfo.InvariantCulture), request);
     }
 }