pitchero/reseller-club

ResellerClub API 的 PHP SDK。

1.9.0 2022-06-20 13:00 UTC

This package is auto-updated.

Last update: 2024-09-20 18:03:15 UTC


README

Build Status

ResellerClub API 的 PHP SDK。

要求

  • PHP >= 7.0

安装

此包通过 Packagist 提供。要使用 Composer 安装到项目中

$ composer require pitchero/reseller-club

示例用法

商业电子邮件

API 文档.

创建订单

API 文档

try {
    $api = new ResellerClub\Api(
         new ResellerClub\Config(123, 'api_key', true),
         new GuzzleHttp\Client()
    )

    $request = new ResellerClub\Orders\BusinessEmails\Requests\BusinessEmailOrderRequest(
        $customerId = 123,
        $domain = 'some-domain.co.uk',
        $numberOfAccount = 5,
        $forNumberOfMonths = 1,
        ResellerClub\Orders\InvoiceOption::noInvoice()
    );    

    $response = $api->businessEmailOrder()->create($request);

    // @todo - Handle a successful response within your codebase.

} catch(ResellerClub\Exceptions\ApiException $e) {
    // @todo - Handle the exception within your codebase.
}

删除订单

API 文档

try {
    $api = new ResellerClub\Api(
         new ResellerClub\Config(123, 'api_key', true),
         new GuzzleHttp\Client()
    );

    $request = new ResellerClub\Orders\Order(
        $orderId = 123
    );

    $response = $api->businessEmailOrder()->delete($request);

    // @todo - Handle the successful response within your codebase.

} catch(ResellerClub\Exceptions\ApiException $e) {
    // @todo - Handle the exception within your codebase.
}

获取订单

API 文档

try {
    $api = new ResellerClub\Api(
         new ResellerClub\Config(123, 'api_key', true),
         new GuzzleHttp\Client()
    );

    $request = new ResellerClub\Orders\Order(
        $orderId = 123
    );   

    $response = $api->businessEmailOrder()->get($request);

    // @todo - Handle the successful response within your codebase.

} catch(ResellerClub\Exceptions\ApiException $e) {
    // @todo - Handle the exception within your codebase.
}

续订订单

API 文档

try {
    $api = new ResellerClub\Api(
         new ResellerClub\Config(123, 'api_key', true),
         new GuzzleHttp\Client()
    );

    $request = new ResellerClub\Orders\BusinessEmails\Requests\RenewRequest(
        new ResellerClub\Orders\Order(
           $orderId = 123
        ),
        $months = 1,
        $numberOfAccounts = 1,
        ResellerClub\Orders\InvoiceOption::noInvoice()
    );

    $response = $api->businessEmailOrder()->renew($request);

    // @todo - Handle the successful response within your codebase.

} catch(ResellerClub\Exceptions\ApiException $e) {
    // @todo - Handle the exception within your codebase.
}

将电子邮件帐户添加到商业电子邮件订单

API 文档

try {
    $api = new ResellerClub\Api(
         new ResellerClub\Config(123, 'api_key', true),
         new GuzzleHttp\Client()
    );

    $request = new ResellerClub\Orders\BusinessEmails\Requests\AddEmailAccountRequest(
        new ResellerClub\Orders\Order(
           $orderId = 123
        ),
        $numberOfAccounts = 1,
        ResellerClub\Orders\InvoiceOption::noInvoice()
    );

    $response = $api->businessEmailOrder()->addEmailAccounts($request);

    // @todo - Handle the successful response within your codebase.

} catch(ResellerClub\Exceptions\ApiException $e) {
    // @todo - Handle the exception within your codebase.
}

从现有的商业电子邮件订单中删除电子邮件帐户

API 文档

try {
    $api = new ResellerClub\Api(
         new ResellerClub\Config(123, 'api_key', true),
         new GuzzleHttp\Client()
    );

    $request = new ResellerClub\Orders\BusinessEmails\Requests\DeleteEmailAccountRequest(
        new ResellerClub\Orders\Order(
           $orderId = 123
        ),
        $numberOfAccounts = 1
    );

    $response = $api->businessEmailOrder()->deleteEmailAccounts($request);
        
    // @todo - Handle the successful response within your codebase.

} catch(ResellerClub\Exceptions\ApiException $e) {
    // @todo - Handle the exception within your codebase.
}

电子邮件帐户

API 文档.

创建电子邮件帐户

API 文档

try {
        $api = new ResellerClub\Api(
             new ResellerClub\Config(123, 'api_key', true),
             new GuzzleHttp\Client()
        );

        $request = ResellerClub\Orders\EmailAccounts\Requests\CreateRequest(
            ResellerClub\Orders\Order(
               $orderId = 123
            ),
            ResellerClub\EmailAddress(
               $email = 'john.doe@some-domain.co.uk'
            ),
            string $password,
            ResellerClub\EmailAddress(
               $notificationsEmail = 'john.doe@backup-email.co.uk'
            ),
            $firstName = 'John',
            $lastName = 'Doe',
            $countryCode = 'UK',
            $languageCode = 'en'
        );

        $response = $api->emailAccount()->create($request);

        // @todo - Handle the successful response within your codebase.

} catch(ResellerClub\Exceptions\ApiException $e) {
    // @todo - Handle the exception within your codebase.
}

删除电子邮件帐户

API 文档

try {
        $api = new ResellerClub\Api(
             new ResellerClub\Config(123, 'api_key', true),
             new GuzzleHttp\Client()
        );

        $request = ResellerClub\Orders\EmailAccounts\Requests\DeleteRequest(
            ResellerClub\Orders\Order(
                $orderId = 123
            ),   
            ResellerClub\EmailAddress(
                $email = 'john.doe@some-domain.co.uk'
            )                     
        );

        $response = $api->emailAccount()->delete($request);

        // @todo - Handle the successful response within your codebase.

} catch(ResellerClub\Exceptions\ApiException $e) {
    // @todo - Handle the exception within your codebase.
}

电子邮件转发

创建电子邮件转发

API 文档

try {
        $api = new ResellerClub\Api(
             new ResellerClub\Config(123, 'api_key', true),
             new GuzzleHttp\Client()
        );

        $request = ResellerClub\Orders\EmailForwarders\Requests\CreateRequest(
              ResellerClub\Orders\Order(
                 $orderId = 123
              ),   
              ResellerClub\EmailAddress(
                $email = 'john.doe@some-domain.co.uk'
              )                   
        );

        $response = $api->emailForwarder()->create($request);

        // @todo - Handle the successful response within your codebase.

} catch(ResellerClub\Exceptions\ApiException $e) {
    // @todo - Handle the exception within your codebase.
}

删除电子邮件转发

API 文档

try {
        $api = new ResellerClub\Api(
             new ResellerClub\Config(123, 'api_key', true),
             new GuzzleHttp\Client()
        );

        $request = ResellerClub\Orders\EmailAccounts\Requests\DeleteRequest(
            ResellerClub\Orders\Order(
                $orderId = 123
            ),   
            ResellerClub\EmailAddress(
                $email = 'john.doe@some-domain.co.uk'
            )                      
        );

        $response = $api->emailForwarder()->delete($request);

        // @todo - Handle the successful response within your codebase.

} catch(ResellerClub\Exceptions\ApiException $e) {
    // @todo - Handle the exception within your codebase.
}

来自 ResellerClub 知识库的有用文章

  1. 如何在测试平台上创建帐户
  2. 在哪里找到和重新生成 API 密钥

添加 A 记录

API 文档

try {
    $ttl = new ResellerClub\TimeToLive(86400);
    $request = new ResellerClub\Dns\A\Requests\AddRequest(
        $domain = 'another-testing-domain.com',
        $record = 'test',
        new ResellerClub\IPv4Address('127.0.0.1'),
        $ttl
    );

    $response = $api->aRecord()->add($request);

    // @todo - Handle the successful response within your codebase.

} catch(ResellerClub\Exceptions\ApiException $e) {
    // @todo - Handle the exception within your codebase.
}

更新 CNAME 记录

API 文档

try {
    $ttl = new ResellerClub\TimeToLive(86400);
    $request = new ResellerClub\Dns\Cname\Requests\UpdateRequest(
        $domain = 'your.com',
        $record = 'www',
        $currentValue = 'cname.oldservice.com',
        $newValue = 'cname.newservice.com',
        $ttl
    );

    $response = $api->cnameRecord()->update($request);

    // @todo - Handle the successful response within your codebase.

} catch(ResellerClub\Exceptions\ApiException $e) {
    // @todo - Handle the exception within your codebase.
}

许可

MIT 许可证 下许可。

问题

如果您发现此包有任何问题,请打开 GitHub Issue