Skip to content

Commit 90c7931

Browse files
author
Benjamin Krammel
committed
TOOLS-1226; fix synchronous return messages
1 parent 5ff0538 commit 90c7931

File tree

4 files changed

+49
-19
lines changed

4 files changed

+49
-19
lines changed

Diff for: src/Service/DomainService.php

+16-9
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@
66
use Domainrobot\Lib\ArrayHelper;
77
use Domainrobot\Lib\DomainrobotConfig;
88
use Domainrobot\Lib\DomainrobotPromise;
9+
use Domainrobot\Model\AutoDeleteDomain;
910
use Domainrobot\Model\Domain;
11+
use Domainrobot\Model\Job;
1012
use Domainrobot\Model\DomainRestore;
13+
use Domainrobot\Model\DomainCancelation;
1114
use Domainrobot\Model\ObjectJob;
1215
use Domainrobot\Model\Query;
1316
use Domainrobot\Service\DomainrobotService;
@@ -834,12 +837,14 @@ public function sendAuthinfoToOwnercAsync($name)
834837
* Update the registry status for an existing domain.
835838
*
836839
* @param Domain $body
837-
* @return void
840+
* @return Job
838841
*/
839842
public function updateStatus(Domain $body)
840843
{
841844
$domainrobotPromise = $this->updateStatusAsync($body);
842-
$domainrobotPromise->wait();
845+
$domainrobotResult = $domainrobotPromise->wait();
846+
847+
return new Job(ArrayHelper::getValueFromArray($domainrobotResult->getResult(), 'data.0', []));
843848
}
844849

845850
/**
@@ -865,7 +870,7 @@ public function updateStatusAsync(Domain $body)
865870
* Inquiring the cancelation data for the specified domain.
866871
*
867872
* @param string $name
868-
* @return JsonResponseDataDomainCancelation
873+
* @return DomainCancelation
869874
*/
870875
public function cancelationInfo($name)
871876
{
@@ -874,7 +879,7 @@ public function cancelationInfo($name)
874879

875880
Domainrobot::setLastDomainrobotResult($domainrobotResult);
876881

877-
// return new JsonResponseDataDomainCancelation(ArrayHelper::getValueFromArray($domainrobotResult->getResult(), 'data.0', []));
882+
return new DomainCancelation(ArrayHelper::getValueFromArray($domainrobotResult->getResult(), 'data.0', []));
878883
}
879884

880885
/**
@@ -895,7 +900,7 @@ public function cancelationInfoAsync($name)
895900
* Inquiring the cancelation data for the specified domain.
896901
*
897902
* @param Domain $body
898-
* @return JsonResponseDataDomainCancelation
903+
* @return DomainCancelation
899904
*/
900905
public function cancelationCreate(Domain $body)
901906
{
@@ -904,7 +909,7 @@ public function cancelationCreate(Domain $body)
904909

905910
Domainrobot::setLastDomainrobotResult($domainrobotResult);
906911

907-
// return new JsonResponseDataDomainCancelation(ArrayHelper::getValueFromArray($domainrobotResult->getResult(), 'data.0', []));
912+
return new DomainCancelation(ArrayHelper::getValueFromArray($domainrobotResult->getResult(), 'data.0', []));
908913
}
909914

910915
/**
@@ -930,7 +935,7 @@ public function cancelationCreateAsync(Domain $body)
930935
* Updating an existing cancelation for the specified domain.
931936
*
932937
* @param Domain $body
933-
* @return JsonResponseDataDomainCancelation
938+
* @return DomainCancelation
934939
*/
935940
public function cancelationUpdate(Domain $body)
936941
{
@@ -939,7 +944,7 @@ public function cancelationUpdate(Domain $body)
939944

940945
Domainrobot::setLastDomainrobotResult($domainrobotResult);
941946

942-
// return new JsonResponseDataDomainCancelation(ArrayHelper::getValueFromArray($domainrobotResult->getResult(), 'data.0', []));
947+
return new DomainCancelation(ArrayHelper::getValueFromArray($domainrobotResult->getResult(), 'data.0', []));
943948
}
944949

945950
/**
@@ -993,14 +998,16 @@ public function cancelationDeleteAsync($name)
993998
* Perform an Whois Request of an Domain
994999
*
9951000
* @param string $name
996-
* @return void
1001+
* @return Domain
9971002
*/
9981003
public function whois($name)
9991004
{
10001005
$domainrobotPromise = $this->whoisAsync($name);
10011006
$domainrobotResult = $domainrobotPromise->wait();
10021007

10031008
Domainrobot::setLastDomainrobotResult($domainrobotResult);
1009+
1010+
return new Domain(ArrayHelper::getValueFromArray($domainrobotResult->getResult(), 'data.0', []));
10041011
}
10051012

10061013
/**

Diff for: src/Service/TrustedApplicationService.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -180,14 +180,16 @@ public function deleteAsync($id)
180180
* Sends a TrustedApplication update request.
181181
*
182182
* @param TrustedApplication $body
183-
* @return void
183+
* @return TrustedApplication
184184
*/
185185
public function update(TrustedApplication $body)
186186
{
187187
$domainrobotPromise = $this->updateAsync($body);
188188
$domainrobotResult = $domainrobotPromise->wait();
189189

190190
Domainrobot::setLastDomainrobotResult($domainrobotResult);
191+
192+
return new TrustedApplication(ArrayHelper::getValueFromArray($domainrobotResult->getResult(), 'data.0', []));
191193
}
192194

193195
/**

Diff for: src/Service/User2faService.php

+11-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

33
namespace Domainrobot\Service;
44

5+
use Domainrobot\Lib\ArrayHelper;
56
use Domainrobot\Domainrobot;
67
use Domainrobot\Lib\DomainrobotConfig;
78
use Domainrobot\Model\JsonNoData;
9+
use Domainrobot\Model\OTPAuth;
810
use Domainrobot\Service\DomainrobotService;
911

1012
class User2faService extends DomainrobotService
@@ -22,14 +24,16 @@ public function __construct(DomainrobotConfig $domainrobotConfig)
2224
/**
2325
* Get Info about the 2FA Configuration
2426
*
25-
* @return
27+
* @return OTPAuth
2628
*/
2729
public function tokenConfigInfo()
2830
{
2931
$domainrobotPromise = $this->tokenConfigInfoAsync();
3032
$domainrobotResult = $domainrobotPromise->wait();
3133

3234
Domainrobot::setLastDomainrobotResult($domainrobotResult);
35+
36+
return new OTPAuth(ArrayHelper::getValueFromArray($domainrobotResult->getResult(), 'data.0', []));
3337
}
3438

3539
/**
@@ -48,14 +52,16 @@ public function tokenConfigInfoAsync()
4852
/**
4953
* Generate 2FA Secret
5054
*
51-
* @return
55+
* @return OTPAuth
5256
*/
5357
public function tokenConfigCreate()
5458
{
5559
$domainrobotPromise = $this->tokenConfigCreateAsync();
5660
$domainrobotResult = $domainrobotPromise->wait();
5761

5862
Domainrobot::setLastDomainrobotResult($domainrobotResult);
63+
64+
return new OTPAuth(ArrayHelper::getValueFromArray($domainrobotResult->getResult(), 'data.0', []));
5965
}
6066

6167
/**
@@ -74,14 +80,16 @@ public function tokenConfigCreateAsync()
7480
/**
7581
* Activate the 2FA Authentication
7682
*
77-
* @return
83+
* @return OTPAuth
7884
*/
7985
public function tokenConfigActivate()
8086
{
8187
$domainrobotPromise = $this->tokenConfigActivateAsync();
8288
$domainrobotResult = $domainrobotPromise->wait();
8389

8490
Domainrobot::setLastDomainrobotResult($domainrobotResult);
91+
92+
return new OTPAuth(ArrayHelper::getValueFromArray($domainrobotResult->getResult(), 'data.0', []));
8593
}
8694

8795
/**

Diff for: src/Service/UserService.php

+19-6
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Domainrobot\Lib\DomainrobotPromise;
99
use Domainrobot\Model\BasicUser;
1010
use Domainrobot\Model\BillingObjectLimit;
11+
use Domainrobot\Model\BillingTerm;
1112
use Domainrobot\Model\JsonNoData;
1213
use Domainrobot\Model\Query;
1314
use Domainrobot\Model\ServiceProfiles;
@@ -386,14 +387,16 @@ public function asyncBillingObjectLimitInfo($queryString)
386387
/**
387388
* Inquiring the Billing Terms for the User
388389
*
389-
* @return void
390+
* @return BillingTerm
390391
*/
391392
public function billingObjectTermsInfo()
392393
{
393394
$domainrobotPromise = $this->asyncBillingObjectTermsInfo();
394395
$domainrobotResult = $domainrobotPromise->wait();
395396

396397
Domainrobot::setLastDomainrobotResult($domainrobotResult);
398+
399+
return new BillingTerm(ArrayHelper::getValueFromArray($domainrobotResult->getResult(), 'data.0', []));
397400
}
398401

399402
/**
@@ -415,7 +418,7 @@ public function asyncBillingObjectTermsInfo()
415418
* @param string $user
416419
* @param string $context
417420
* @param array $keys
418-
* @return void
421+
* @return User
419422
*/
420423
public function updateLock($user, $context, array $keys = [])
421424
{
@@ -428,6 +431,8 @@ public function updateLock($user, $context, array $keys = [])
428431
$domainrobotResult = $domainrobotPromise->wait();
429432

430433
Domainrobot::setLastDomainrobotResult($domainrobotResult);
434+
435+
return new User(ArrayHelper::getValueFromArray($domainrobotResult->getResult(), 'data.0', []));
431436
}
432437

433438
/**
@@ -452,7 +457,7 @@ public function asyncUpdateLock($user, $context, $keysString)
452457
* @param string $user
453458
* @param string $context
454459
* @param array $keys
455-
* @return void
460+
* @return User
456461
*/
457462
public function updateUnlock($user, $context, array $keys = [])
458463
{
@@ -465,6 +470,8 @@ public function updateUnlock($user, $context, array $keys = [])
465470
$domainrobotResult = $domainrobotPromise->wait();
466471

467472
Domainrobot::setLastDomainrobotResult($domainrobotResult);
473+
474+
return new User(ArrayHelper::getValueFromArray($domainrobotResult->getResult(), 'data.0', []));
468475
}
469476

470477
/**
@@ -488,14 +495,16 @@ public function asyncUpdateUnlock($user, $context, $keysString)
488495
*
489496
* @param string $user
490497
* @param string $context
491-
* @return void
498+
* @return User
492499
*/
493500
public function aclInfo($user, $context)
494501
{
495502
$domainrobotPromise = $this->asyncAclInfo($user, $context);
496503
$domainrobotResult = $domainrobotPromise->wait();
497504

498505
Domainrobot::setLastDomainrobotResult($domainrobotResult);
506+
507+
return new User(ArrayHelper::getValueFromArray($domainrobotResult->getResult(), 'data.0', []));
499508
}
500509

501510
/**
@@ -517,14 +526,16 @@ public function asyncAclInfo($user, $context)
517526
* User ACL Update
518527
*
519528
* @param object $body
520-
* @return void
529+
* @return User
521530
*/
522531
public function aclUpdate($body)
523532
{
524533
$domainrobotPromise = $this->asyncAclUpdate($body);
525534
$domainrobotResult = $domainrobotPromise->wait();
526535

527536
Domainrobot::setLastDomainrobotResult($domainrobotResult);
537+
538+
return new User(ArrayHelper::getValueFromArray($domainrobotResult->getResult(), 'data.0', []));
528539
}
529540

530541
/**
@@ -710,14 +721,16 @@ public function asyncServiceProfileInfo($user, $context, $prefix)
710721
* @param string $user
711722
* @param string $context
712723
* @param ServiceProfiles $body
713-
* @return DomainrobotPromise
724+
* @return ServiceUsersProfile
714725
*/
715726
public function serviceProfileUpdate($user, $context, ServiceProfiles $body)
716727
{
717728
$domainrobotPromise = $this->asyncServiceProfileUpdate($user, $context, $body);
718729
$domainrobotResult = $domainrobotPromise->wait();
719730

720731
Domainrobot::setLastDomainrobotResult($domainrobotResult);
732+
733+
return new ServiceUsersProfile(ArrayHelper::getValueFromArray($domainrobotResult->getResult(), 'data.0', []));
721734
}
722735

723736
/**

0 commit comments

Comments
 (0)