om-hosting/openmeetings-php-client

OpenMeetings PHP 包,用于暴露 OpenMeetings Rest API - 请参阅 https://openmeetings.apache.org/swagger/

2.0.0 2021-09-29 04:40 UTC

This package is auto-updated.

Last update: 2024-09-29 06:14:29 UTC


README

Packagist License GitHub issues Packagist Version Packagist Downloads

PHP Composer 管理的包,用于连接到 OpenMeetings REST API (https://openmeetings.apache.org/swagger/)。

另请参阅: https://packagist.org.cn/packages/om-hosting/openmeetings-php-client

示例用例

请参阅示例用例: https://om-hosting.com/openmeetings-integration-php-composer/

版本和兼容性

安装

安装 packagist 包

php composer.phar install openmeetings-php-client

用法:示例用法

        $BASE_URL = "https://: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;

请参阅以下示例项目代码:https://github.com/om-hosting/openmeetings-php-laravel-sample-project

描述

集成 API 允许连接到 OpenMeetings 实例,例如用于生成用户、创建直接访问会议室的链接。

它主要是为 Server2Server 集成设计的,例如集成到您的网站、CMS 或第三方应用程序

有关如何使用 Rest API 的示例,请参阅 https://openmeetings.apache.org/RestAPISample.html

为使用此 API 贡献的社区模块包括例如

其他社区插件使用此 API 用于 Moodle、SugarCRM、Drupal、Joomla,可在 https://openmeetings.apache.org 的配置>插件部分找到

此 PHP 包的初始版本由 Swagger Codegen 项目自动生成

要求

PHP 5.5 及以上

安装 & 使用

Composer

要使用 Composer 安装绑定,请在 composer.json 中添加以下内容

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

然后运行 composer install

手动安装

下载文件并包含 autoload.php

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

测试

要运行单元测试

composer install
./vendor/bin/phpunit

入门

请遵循 安装过程,然后运行以下操作

<?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;
}
?>

API 端点文档

所有 URI 都是相对于 https://:5080/openmeetings/services

模型文档

授权文档

认证令牌是通过调用 UserServiceApi->login 获取的。

作者

Sebastian Wagner https://om-hosting.com