-
Notifications
You must be signed in to change notification settings - Fork 12
/
DomainUpdateStatus.php
50 lines (42 loc) · 1.37 KB
/
DomainUpdateStatus.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
namespace Example;
use Domainrobot\Domainrobot;
use Domainrobot\Lib\DomainrobotAuth;
use Domainrobot\Lib\DomainrobotException;
use Domainrobot\Model\ObjectJob;
use Domainrobot\Model\RegistryStatusConstants;
/**
* This example is focused on a domain update the general principle holds true
* for ALL tasks you want to execute for a subuser of your auth user
*/
class SDKController
{
/**
* Inquire and update a domain for a subuser
* returns an ObjectJob since the task itself is asynchronous
*
* @return ObjectJob
*/
public function updateStatus()
{
$domainrobot = new Domainrobot([
"url" => "https://api.autodns.com/v1",
"auth" => new DomainrobotAuth([
"user" => "username",
"password" => "password",
"context" => 4
])
]);
try {
// Domainrobot/Model/Domain
$domain = $domainrobot->domain->info("example.com");
// update the domain model with the new data
$domain->setRegistryStatus(RegistryStatusConstants::HOLD_LOCK);
// to update the domain for the subuser set the following headers
$job = $domainrobot->domain->updateStatus($domain);
} catch (DomainrobotException $exception) {
return$exception;
}
return $job;
}
}