om-hosting/openmeetings-php-client

OpenMeetings PHP package to expose OpenMeetings Rest API - see https://openmeetings.apache.org/swagger/

2.0.0 2021-09-29 04:40 UTC

This package is auto-updated.

Last update: 2024-08-29 06:01:47 UTC


README

Packagist License GitHub issues Packagist Version Packagist Downloads

PHP composer managed package to connect to OpenMeetings REST API (https://openmeetings.apache.org/swagger/).

See also: https://packagist.org/packages/om-hosting/openmeetings-php-client

Example use case

See the example use case at: https://om-hosting.com/openmeetings-integration-php-composer/

Version and compatibility

Installation

Install packagist package:

php composer.phar install openmeetings-php-client

Usage: Example usage:

        $BASE_URL = "http://localhost:5080/openmeetings";
    
        //1. Login to service
        $config = new Configuration();
        $config->setHost($BASE_URL . '/services');
        $userApiInstance = new UserServiceApi(null, $config);
        $serviceResultLoginWrapper = $userApiInstance->login("soapuser", "!HansHans1");
        if ($serviceResultLoginWrapper->getServiceResult()->getType() != "SUCCESS") {
            $text = "Login Failed " . $serviceResultLoginWrapper->getServiceResult()->getMessage();
            return view('hello_index', ['text' => $text]);
        }
        $sid = $serviceResultLoginWrapper->getServiceResult()->getMessage();

        // 2. Generate Hash for entering a conference room
        $serviceResultHashWrapper = $userApiInstance->getRoomHash($sid,
            new ExternalUserDTO(
                array(
                    "firstname" => "John",
                    "lastname" => "Doe",
                    "external_id" => "uniqueId1",
                    "external_type" => "myCMS",
                    "login" => "john.doe",
                    "email" => "john.doe@gmail.com"
                )
            ),
            new RoomOptionsDTO(
                array(
                    "room_id" => 2,
                    "moderator" => true
                )
            )
        );

        // 3. Construct Login URL
        $hash = $serviceResultHashWrapper->getServiceResult()->getMessage();
        $url = $this->BASE_URL . "/hash?secure=".$hash;

See also example project code at: https://github.com/om-hosting/openmeetings-php-laravel-sample-project

Description

Integration API enables to connect to an OpenMeetings instance, eg for generating users, create links to directly access conference rooms.

It is mainly designed for Server2Server integration, for example to integrate into your website, CMS or 3rd party application

For examples how to use the Rest API see https://openmeetings.apache.org/RestAPISample.html.

Community contributed modules for using this API include for example:

Other community plugins using this API for Moodle, SugarCRM, Drupal, Joomla can be found in the Configuration>Plugins section at https://openmeetings.apache.org

Initial version of this PHP package is automatically generated by the Swagger Codegen project:

Requirements

PHP 5.5 and later

Installation & Usage

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/om-hosting/openmeetings-php-client.git"
    }
  ],
  "require": {
    "om-hosting/openmeetings-php-client": "*@dev"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

    require_once('/path/to/openmeetings-php-client/vendor/autoload.php');

Tests

To run the unit tests:

composer install
./vendor/bin/phpunit

Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once(__DIR__ . '/vendor/autoload.php');

$apiInstance = new Swagger\Client\Api\CalendarServiceApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$sid = "sid_example"; // string | The SID of the User. This SID must be marked as Loggedin
$id = 789; // int | the id to delete

try {
    $result = $apiInstance->delete($sid, $id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CalendarServiceApi->delete: ', $e->getMessage(), PHP_EOL;
}

$apiInstance = new Swagger\Client\Api\CalendarServiceApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$sid = "sid_example"; // string | The SID of the User. This SID must be marked as Loggedin
$roomid = 789; // int | id of appointment special room

try {
    $result = $apiInstance->getByRoom($sid, $roomid);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CalendarServiceApi->getByRoom: ', $e->getMessage(), PHP_EOL;
}

$apiInstance = new Swagger\Client\Api\CalendarServiceApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$sid = "sid_example"; // string | The SID of the User. This SID must be marked as Loggedin
$title = "title_example"; // string | the search string

try {
    $result = $apiInstance->getByTitle($sid, $title);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CalendarServiceApi->getByTitle: ', $e->getMessage(), PHP_EOL;
}

$apiInstance = new Swagger\Client\Api\CalendarServiceApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$sid = "sid_example"; // string | The SID of the User. This SID must be marked as Loggedin

try {
    $result = $apiInstance->next($sid);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CalendarServiceApi->next: ', $e->getMessage(), PHP_EOL;
}

$apiInstance = new Swagger\Client\Api\CalendarServiceApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$sid = "sid_example"; // string | The SID of the User. This SID must be marked as Loggedin
$userid = 789; // int | the userId the calendar events should be loaded

try {
    $result = $apiInstance->nextForUser($sid, $userid);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CalendarServiceApi->nextForUser: ', $e->getMessage(), PHP_EOL;
}

$apiInstance = new Swagger\Client\Api\CalendarServiceApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$sid = "sid_example"; // string | The SID of the User. This SID must be marked as Loggedin
$start = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | start time
$end = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | end time

try {
    $result = $apiInstance->range($sid, $start, $end);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CalendarServiceApi->range: ', $e->getMessage(), PHP_EOL;
}

$apiInstance = new Swagger\Client\Api\CalendarServiceApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$sid = "sid_example"; // string | The SID of the User. This SID must be marked as Loggedin
$userid = 789; // int | the userId the calendar events should be loaded
$start = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | start time
$end = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | end time

try {
    $result = $apiInstance->rangeForUser($sid, $userid, $start, $end);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CalendarServiceApi->rangeForUser: ', $e->getMessage(), PHP_EOL;
}

$apiInstance = new Swagger\Client\Api\CalendarServiceApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$sid = "sid_example"; // string | The SID of the User. This SID must be marked as Loggedin
$appointment = new \Swagger\Client\Model\AppointmentDTO(); // \Swagger\Client\Model\AppointmentDTO | 

try {
    $result = $apiInstance->save($sid, $appointment);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CalendarServiceApi->save: ', $e->getMessage(), PHP_EOL;
}
?>

Documentation for API Endpoints

All URIs are relative to http://localhost:5080/openmeetings/services

Documentation For Models

Documentation For Authorization

Authentication token is acquired via calling UserServiceApi->login

Author

Sebastian Wagner https://om-hosting.com