vanilla/hipchat-api

Hipchat v2 API client

v2.0 2016-04-29 15:01 UTC

This package is auto-updated.

Last update: 2024-11-15 14:01:28 UTC


README

Packagist Version MIT License

hipchat-api is a PHP library that provides an implementation of the HipChat v2 REST API.

Installation

hipchat-api requires PHP 5.4 or higher

hipchat-api is PSR-4 compliant and can be easily installed using composer.

Just add vanilla/hipchat-api to your composer.json.

"require": {
    "vanilla/hipchat-api": "~2.0"
}

Usage

HipChat uses OAuth2 tokens with specific scopes to control API access. You can request a token for yourself by visiting the HipChat Account/API page.

<?php

// The library lives in the HipChat namespace.
use HipChat\v2\HipChatClient;

// Require composer's autoloader.
require_once 'vendor/autoload.php';

// Define the cli options.
$client = new HipChatClient();
$client->setAuth('<OAUTH BEARER TOKEN>');

// Start making calls!
$users = $client->usersAPI()->getAll();

This example makes a call to the Users API to get all users.

  • You can make the client throw an exception instead of returning false on error by calling setThrowExceptions(true) on $client.

Custom API Endpoint

If you are using a private instance of HipChat, you can change the API base URL when you instantiate the client:

<?php

use HipChat\v2\HipChatClient;

$client = new HipChatClient('https://my.hipchatdomain.com');
  • You can also change the base URL at any time by calling setBaseUrl() on an existing $client.

Current status

The following list shows methods available and missing:

###Add ons

  • Get addon installable data
  • Create addon link
  • Invoke addon link
  • Delete addon link

###Capabilities

  • Get capabilities

###Emoticons

  • Get emoticon
  • Get all emoticons

###OAuth Sessions

  • Generate token
  • Get session
  • Delete session

###Rooms

  • Get all rooms
  • Create room
  • Get room
  • Update room
  • Delete room
  • Get avatar
  • Update avatar
  • Delete avatar
  • Get room message
  • View room history
  • View recent room history
  • Get glance
  • Create glance
  • Delete glance
  • Invite user
  • Add member
  • Remove member
  • Get all members
  • Get all participants
  • Send message
  • Send room notification
  • Reply to message
  • Share file with room
  • Share link with room
  • Get room statistics
  • Set topic
  • Get webhook
  • Delete webhook
  • Get all webhooks
  • Create webhook

###Users

  • Get all users
  • Create user
  • View user
  • Update user
  • Delete user
  • View privatechat history
  • View recent privatechat history
  • Get private chat message
  • Send message to user
  • Get photo
  • Upload photo
  • Delete photo
  • Get preference (auto-join)
  • Share file with user
  • Share link with user