public static void SendError(string errorMessage, int roomId) { var hipchatClient = new HipchatClient(); errorMessage = "<b>Malfunction!</b><br/>" + errorMessage; hipchatClient.SendNotification(roomId, errorMessage, HipchatApiV2.Enums.RoomColors.Red); }
public static void SendToRoom(string message, string roomname, string token) { try { HipchatClient client = new HipchatClient(token); HipchatGetRoomResponse room = client.GetRoom(roomname); if (room != null) { if (message.Contains("KILL")) { client.SendNotification(room.Id, message, RoomColors.Green, true, HipchatMessageFormat.Text); } else if (message.Contains("LOSS")) { client.SendNotification(room.Id, message, RoomColors.Red, true, HipchatMessageFormat.Text); } else { client.SendNotification(room.Id, message, RoomColors.Random, true, HipchatMessageFormat.Text); } } } catch (Exception ex) { } }
public MainWindow() { _client = new HipchatClient(); InitializeComponent(); PopulateRooms(); PollNotifications(); }
public ShareFileWithRoom() { HipchatApiConfig.AuthToken = TestsConfig.AuthToken; _client = new HipchatClient(); _existingRoomId = TestHelpers.GetARoomId(_client, "Share File With Room Test Room"); }
static void Main(string[] args) { var hipApi = new HipchatClient("9MOu2XAKyDn6XRTvUQRxpc8TegMN1TiLI2fQlex8"); var afApi = new AnytimeFitnessApiClient("http://api.anytimefitness.com", Guid.Parse("2314833F-CFC9-4C84-BB10-5574507DCB4A")); var room = hipApi.GetRoom("Anytimefitness"); var lastTx = DateTime.UtcNow; var lastMessage = ""; while (true) { var history = hipApi.GetRoomHistory(room.Name); var first = history.items[0]; if (first.message == lastMessage) { Thread.Sleep(30000); continue; } if (first.from == "scotch_bot") { hipApi.SendNotification(room.Id, new SendRoomNotificationRequest { Color = RoomColors.Purple, Message = "@scotchbot I know you are, but what am I?", MessageFormat = HipchatMessageFormat.Html, Notify = false }); Thread.Sleep(10000); } } }
public SendRoomNotification() { HipchatApiConfig.AuthToken = TestsConfig.AuthToken; _client = new HipchatClient(); _existingRoomId = _client.CreateRoom("Send Notification Test Room").Id; }
public void CanGetAllUsers() { var client = new HipchatClient(); var users = client.GetAllUsers(); Assert.NotNull(users); }
public SendRoomNotification() { HipchatApiConfig.AuthToken = TestsConfig.AuthToken; _client = new HipchatClient(); _existingRoomId = TestHelpers.GetARoomId(_client,"Send Notification Test Room"); }
public void CanGetAllEmoticons() { var client = new HipchatClient(); var emoticons = client.GetAllEmoticons(); Assert.Equal(100, emoticons.Items.Count); }
public void CanGetEmoticonByKnownShortcut() { var client = new HipchatClient(); var emoticonByShortcut = client.GetEmoticon("allthethings"); Assert.True(emoticonByShortcut.Height > 0); Assert.True(emoticonByShortcut.Width > 0); }
public GetAllWebhooksTests() { HipchatApiConfig.AuthToken = TestsConfig.AuthToken; _client = new HipchatClient(); var room = _client.CreateRoom("Test Webhooks Room"); _existingRoomId = room.Id; }
public GetRoomTests() { const string roomName = "Test GetRooms"; HipchatApiConfig.AuthToken = TestsConfig.AuthToken; _client = new HipchatClient(); var room = TestHelpers.GetARoomId(_client, roomName); _existingRoomId = room; _existingRoomName = "Test GetRooms"; }
public void CanGetUserInfo() { var userId = 42494; var client = new HipchatClient(); var userInfo = client.GetUserInfo(userId); Assert.NotNull(userInfo); }
public GetRoomTests() { const string roomName = "Test GetRooms"; HipchatApiConfig.AuthToken = TestsConfig.AuthToken; _client = new HipchatClient(); var room = _client.CreateRoom(roomName); _existingRoomId = room.Id; _existingRoomName = "Test GetRooms"; }
public void CanCreateRoom() { IHipchatClient client = new HipchatClient(); var result = client.CreateRoom(RoomName); Assert.NotNull(result); Assert.NotNull(result.Links); Assert.NotNull(result.Links.Self); }
public UpdateRoomTests() { HipchatApiConfig.AuthToken = TestsConfig.AuthToken; _client = new HipchatClient(); var room = _client.CreateRoom("TestUpdateRoom"); _createdRoomId = room.Id; var getRoomResponse = _client.GetRoom(_createdRoomId); _owner = getRoomResponse.Owner; }
public void CanDeleteRoom() { const string testRoomName = "Delete Me"; var client = new HipchatClient(); client.CreateRoom(testRoomName); var result = client.DeleteRoom(testRoomName); Assert.True(result); }
public void CanGetEmoticonByShortcut() { var client = new HipchatClient(); var emoticons = client.GetAllEmoticons(); var firstEmoticon = emoticons.Items[0]; var emoticonByShortcut = client.GetEmoticon(firstEmoticon.Shortcut); Assert.Equal(firstEmoticon.Shortcut, emoticonByShortcut.Shortcut); Assert.True(emoticonByShortcut.Height > 0); Assert.True(emoticonByShortcut.Width > 0); }
public void CanGetEmoticonById() { var client = new HipchatClient(); var emoticons = client.GetAllEmoticons(); var firstEmoticon = emoticons.Items[0]; var emoticonById = client.GetEmoticon(firstEmoticon.Id); Assert.Equal(firstEmoticon.Id, emoticonById.Id); Assert.True(emoticonById.Height > 0); Assert.True(emoticonById.Width > 0); }
private static void Main(string[] args) { //Setup shit const int roomId = 510675; const string postToUrl = "http://kylegobel.com/hipchatRedisRelay/message"; var client = new HipchatClient(); client.CreateWebHook(roomId, postToUrl, "", HipchatApiV2.Enums.RoomEvent.RoomNotification, "Botso send message hook"); Console.ReadLine(); }
public static void CreateUser(string token, string name, string email, string title, string password) { HipchatClient client = new HipchatClient(token); HipchatApiV2.Requests.CreateUserRequest request = new HipchatApiV2.Requests.CreateUserRequest(); request.Name = name; request.MentionName = name.Replace(" ", ""); request.Title = title; request.Email = email; request.Password = password; HipchatCreateUserResponse response = client.CreateUser(request); }
private static void Main() { HipchatClient hipchatClient = new HipchatClient("1KoQTmxVnWZDcHObCfPKKKvMnR9msOlX4Wn54fJG"); var r = hipchatClient.SendNotification(2259497, new SendRoomNotificationRequest { MessageFormat = HipchatMessageFormat.Text, Message = "Hello :) (yey)", Color = RoomColors.Green, Notify = true }); }
public static int GetARoomId(HipchatClient client, string roomName) { try { var room = client.GetRoom(roomName); return room.Id; } catch (HipchatRoomNotFoundException) { var room = client.CreateRoom(roomName); return room.Id; } }
//[Fact] public void GenerateAuthToken() { //insert your authId and auth Secret here const string authId = ""; const string authSecret = ""; var client = new HipchatClient(); var token = client.GenerateToken(GrantType.ClientCredentials, new List<TokenScope> {TokenScope.SendNotification}, authId, authSecret); Assert.NotNull(token); }
//[Fact] public void GenerateAuthTokenWithUsernameAndPassword() { //insert your username and password here const string username = ""; const string password = ""; var client = new HipchatClient("YourToken"); var token = client.GenerateToken(GrantType.Password, Enumerable.Empty<TokenScope>(), username, password:password); Assert.NotNull(token); }
public static List<string> GetAllRooms(string token) { HipchatClient client = new HipchatClient(token); HipchatGetAllRoomsResponse rooms = client.GetAllRooms(); List<string> RoomNames = new List<string>(); foreach (HipchatGetAllRoomsResponseItems room in rooms.Items) { RoomNames.Add(room.Name); } return RoomNames; }
public static List<string> GetAllUsers(string token) { HipchatClient client = new HipchatClient(token); HipchatGetAllUsersResponse users = client.GetAllUsers(); List<string> UserNames = new List<string>(); foreach (HipchatUser user in users.Items) { UserNames.Add(user.Name); } return UserNames; }
public ViewRecentRoomHistoryTests() { const string roomName = "Test ViewRecentRoomHistory"; HipchatApiConfig.AuthToken = TestsConfig.AuthToken; _client = new HipchatClient(); _existingRoomId = TestHelpers.GetARoomId(_client, roomName); _existingRoomName = roomName; // Add notifications to history _client.SendNotification(_existingRoomId, "First entry to history"); _client.ShareFileWithRoom(_existingRoomId.ToString(), @"..\..\Data\RUv8sSn.png", "Second entry to history with file"); }
public void GenerateTokenExample() { var client = new HipchatClient(); var token = client.GenerateToken(GrantType.ClientCredentials, new List<TokenScope> { TokenScope.SendNotification, }, "", /*Auth Id*/ "" /*Auth Secret*/); Assert.NotNull(token); }
public UpdateUserTests() { HipchatApiConfig.AuthToken = TestsConfig.AuthToken; _client = new HipchatClient(); try { _client.GetUserInfo(UserEmail); } catch (Exception) { _client.CreateUser(new CreateUserRequest() {Email = UserEmail, Name = UserName}); } }