ciaranpflanagan/webinarjam-api

此包最新版本(v1.0.1)没有可用的许可证信息。

WebinarJam API 包装器

v1.0.1 2021-04-12 09:28 UTC

This package is auto-updated.

Last update: 2024-09-12 17:07:28 UTC


README

一个 composer 包,使与 WebinarJam API 的通信变得更加容易。

安装

composer require ciaranpflanagan/webinarjam-api

将服务提供者添加到您的 config/app.php 提供者数组中

ciaranpflanagan\WebinarJamApi\WebinarJamServiceProvider::class

用法

包含该包以便可以使用

use ciaranpflanagan\WebinarJamApi\WebinarJam;

创建 WebinarJam 类的新实例,传入您的 WebinarJam API 密钥。更多关于获取 API 密钥的信息可以在WebinarJam API 文档中找到。

$webinar = new WebinarJam('WEBINARJAM_API_KEY');

列出所有研讨会

获取完整研讨会列表。这将返回 API 的响应数组。

$webinar->webinars();

输出

{
    "status": "success",
    "webinars": [
        {
            "webinar_id": 1,
            "webinar_hash": "gfdsg765g",
            "name": "First Webinar",
            "description": "First Webinar From API",
            "type": "Series of presentations",
            "schedules": [
                "Every day, 9:00 AM"
            ],
            "timezone": "Europe\/Dublin"
        },
        {
            "webinar_id": 2,
            "webinar_hash": "gfdsg765g",
            "name": "Second Webinar",
            "description": "Second Webinar From API",
            "type": "Series of presentations",
            "schedules": [
                "Every day, 9:00 AM"
            ],
            "timezone": "Europe\/Dublin"
        }
    ]
}

单个研讨会的详细信息

获取单个研讨会的详细信息(包括其日程)。这将返回 API 的响应数组。

/**
 * @param int $webinar_id
 */
$webinar->webinarDetails($webinar_id);

输出

{
    "status": "success",
    "webinar": {
        "webinar_id": 1,
        "webinar_hash": "gfdsg765g",
        "name": "First Webinar",
        "description": "First Webinar From API",
        "type": "Series of presentations",
        "schedules": [
            {
                "date": "2021-03-25 09:00",
                "schedule": 99,
                "comment": "Every day, 9:00 AM"
            }
        ],
        "timezone": "Europe\/Dublin",
        "presenters": [
            {
                "name": "Ciaran Flanagan",
                "email": "test@test.com",
                "picture": ""
            }
        ],
        "registration_url": "",
        "registration_type": "free",
        "registration_fee": 0,
        "registration_currency": "",
        "registration_checkout_url": "",
        "registration_post_payment_url": "",
        "direct_live_room_url": "",
        "direct_replay_room_url": ""
    }
}

将人员注册到研讨会

将人员注册到研讨会。这将返回 API 的响应数组。
注意: $webinar_id$scheduleint 类型。

/**
 * @param int $webinar_id
 * @param array $details
 */
$details = array(
    "first_name" => "",
    "last_name" => "", // Optional
    "email" => "",
    "schedule" => 0,
    "ip_address" => "", // Optional
    "phone_country_code" => "", // Optional
    "phone" => "", // Optional
);

$webinar->register($webinar_id, $details);

输出

{
    "status": "success",
    "user": {
        "webinar_id": 1,
        "webinar_hash": "gfdsg765g",
        "user_id": 1234,
        "first_name": "Ciaran",
        "last_name": "Flanagan",
        "phone_country_code": "+353",
        "phone": "123456789",
        "email": "test@test.com",
        "password": null,
        "schedule": "99",
        "date": "2021-03-25 9:00",
        "timezone": "Europe\/Dublin",
        "live_room_url": "",
        "replay_room_url": "",
        "thank_you_url": ""
    }
}

获取研讨会的日程

获取研讨会的日程。这将返回 API 的响应数组。

/**
 * @param int $webinar_id
 */
$webinar->webinarSchedule($webinar_id);

// or
$webinar->webinarDetails($webinar_id);
$webinar->webinarSchedule();

注意: 如果已经调用过 ->webinarDetails($webinar_id),则可以不带参数调用 ->webinarSchedule(),它将使用与 ->webinarDetails($webinar_id) 中相同的研讨会 ID 获取日程。

输出

[
    [
        "date" => "2021-03-25 09:00",
        "schedule" => 99,
        "comment" => "Every day, 9:00 AM",
    ],
    [
        "date" => "2021-03-52 09:00",
        "schedule" => 99,
        "comment" => "Every day, 9:00 AM",
    ],
]