Skip to content

Commit

Permalink
extracted Profile Endpoints from Pull Request amabnl#336 of the main …
Browse files Browse the repository at this point in the history
…Repository

refactored code, removed duplicates and removed IDE specific comments
  • Loading branch information
Patrick Kilter committed Feb 2, 2020
1 parent 3d5c76c commit eddff2e
Show file tree
Hide file tree
Showing 13 changed files with 287 additions and 0 deletions.
80 changes: 80 additions & 0 deletions src/Amadeus/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -1527,6 +1527,86 @@ public function priceXplorerExtremeSearch(
return $this->callMessage($msgName, $options, $messageOptions);
}

/**
* Profile_ReadProfile
*
* @param RequestOptions\ProfileReadProfileOptions $options
* @param array $messageOptions (OPTIONAL)
* @return Result
* @throws Client\InvalidMessageException
* @throws Client\RequestCreator\MessageVersionUnsupportedException
* @throws Exception
*/
public function profileReadProfile(
RequestOptions\ProfileReadProfileOptions $options,
$messageOptions = []
)
{
$msgName = 'Profile_ReadProfile';

return $this->callMessage($msgName, $options, $messageOptions);
}

/**
* Profile_CreateProfile
*
* @param RequestOptions\ProfileCreateProfileOptions $options
* @param array $messageOptions (OPTIONAL)
* @return Result
* @throws Client\InvalidMessageException
* @throws Client\RequestCreator\MessageVersionUnsupportedException
* @throws Exception
*/
public function profileCreateProfile(
RequestOptions\ProfileCreateProfileOptions $options,
$messageOptions = []
)
{
$msgName = 'Profile_CreateProfile';

return $this->callMessage($msgName, $options, $messageOptions);
}

/**
* Profile_CreateProfile
*
* @param RequestOptions\ProfileDeleteProfileOptions $options
* @param array $messageOptions (OPTIONAL)
* @return Result
* @throws Client\InvalidMessageException
* @throws Client\RequestCreator\MessageVersionUnsupportedException
* @throws Exception
*/
public function profileDeleteProfile(
RequestOptions\ProfileDeleteProfileOptions $options,
$messageOptions = []
)
{
$msgName = 'Profile_DeleteProfile';

return $this->callMessage($msgName, $options, $messageOptions);
}

/**
* Profile_UpdateProfile
*
* @param RequestOptions\ProfileUpdateProfileOptions $options
* @param array $messageOptions (OPTIONAL)
* @return Result
* @throws Client\InvalidMessageException
* @throws Client\RequestCreator\MessageVersionUnsupportedException
* @throws Exception
*/
public function profileUpdateProfile(
RequestOptions\ProfileUpdateProfileOptions $options,
$messageOptions = []
)
{
$msgName = 'Profile_UpdateProfile';

return $this->callMessage($msgName, $options, $messageOptions);
}

/**
* SalesReports_DisplayQueryReport
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace Amadeus\Client\RequestCreator\Converter\Profile;
use Amadeus\Client\RequestCreator\Converter\BaseConverter;
use Amadeus\Client\RequestOptions\ProfileCreateProfileOptions;
use Amadeus\Client\Struct;

class CreateProfileConv extends BaseConverter
{
/**
* @param ProfileCreateProfileOptions $requestOptions
* @param int|string $version
* @return Struct\Profile\ProfileCreateProfile
*/
public function convert($requestOptions, $version)
{
return new Struct\Profile\ProfileCreateProfile($requestOptions);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace Amadeus\Client\RequestCreator\Converter\Profile;
use Amadeus\Client\RequestCreator\Converter\BaseConverter;
use Amadeus\Client\RequestOptions\ProfileDeleteProfileOptions;
use Amadeus\Client\Struct;

class DeleteProfileConv extends BaseConverter
{
/**
* @param ProfileDeleteProfileOptions $requestOptions
* @param int|string $version
* @return Struct\Profile\ProfileDeleteProfile
*/
public function convert($requestOptions, $version)
{
return new Struct\Profile\ProfileDeleteProfile($requestOptions);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace Amadeus\Client\RequestCreator\Converter\Profile;
use Amadeus\Client\RequestCreator\Converter\BaseConverter;
use Amadeus\Client\RequestOptions\ProfileReadProfileOptions;
use Amadeus\Client\Struct;
class ReadProfileConv extends BaseConverter
{
/**
* @param ProfileReadProfileOptions $requestOptions
* @param int|string $version
* @return Struct\Profile\ProfileReadProfile
*/
public function convert($requestOptions, $version)
{
return new Struct\Profile\ProfileReadProfile($requestOptions);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace Amadeus\Client\RequestCreator\Converter\Profile;
use Amadeus\Client\RequestCreator\Converter\BaseConverter;
use Amadeus\Client\RequestOptions\ProfileUpdateProfileOptions;
use Amadeus\Client\Struct;

class UpdateProfileConv extends BaseConverter
{
/**
* @param ProfileUpdateProfileOptions $requestOptions
* @param int|string $version
* @return Struct\Profile\ProfileUpdateProfile
*/
public function convert($requestOptions, $version)
{
return new Struct\Profile\ProfileUpdateProfile($requestOptions);
}
}
12 changes: 12 additions & 0 deletions src/Amadeus/Client/RequestOptions/ProfileCreateProfileOptions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Amadeus\Client\RequestOptions;

class ProfileCreateProfileOptions extends Base
{
public $Version;
public $UniqueID;
public $Profile;
public $CompanyName;

}
11 changes: 11 additions & 0 deletions src/Amadeus/Client/RequestOptions/ProfileDeleteProfileOptions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace Amadeus\Client\RequestOptions;

class ProfileDeleteProfileOptions extends Base
{
public $Version;
public $UniqueID;
public $DeleteRequests;

}
11 changes: 11 additions & 0 deletions src/Amadeus/Client/RequestOptions/ProfileReadProfileOptions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace Amadeus\Client\RequestOptions;

class ProfileReadProfileOptions extends Base
{
public $Version;
public $UniqueID;
public $ReadRequests;

}
11 changes: 11 additions & 0 deletions src/Amadeus/Client/RequestOptions/ProfileUpdateProfileOptions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace Amadeus\Client\RequestOptions;

class ProfileUpdateProfileOptions extends Base
{
public $Position;
public $UniqueID=[];
public $Version;

}
22 changes: 22 additions & 0 deletions src/Amadeus/Client/Struct/Profile/ProfileCreateProfile.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace Amadeus\Client\Struct\Profile;
use Amadeus\Client\Struct\BaseWsMessage;

class ProfileCreateProfile extends BaseWsMessage
{
public $Version;
public $UniqueID;
public $Profile;
public $CompanyName;

public function __construct($options)
{
if (!is_null($options)) {
$this->Version= $options->Version;
$this->UniqueID= $options->UniqueID;
$this->Profile= $options->Profile;
$this->CompanyName= $options->CompanyName;
}
}
}
20 changes: 20 additions & 0 deletions src/Amadeus/Client/Struct/Profile/ProfileDeleteProfile.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace Amadeus\Client\Struct\Profile;
use Amadeus\Client\Struct\BaseWsMessage;

class ProfileDeleteProfile extends BaseWsMessage
{
public $Version;
public $UniqueID;
public $DeleteRequests;

public function __construct($options)
{
if (!is_null($options)) {
$this->Version= $options->Version;
$this->UniqueID= $options->UniqueID;
$this->DeleteRequests= $options->DeleteRequests;
}
}
}
22 changes: 22 additions & 0 deletions src/Amadeus/Client/Struct/Profile/ProfileReadProfile.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace Amadeus\Client\Struct\Profile;
use Amadeus\Client\Struct\BaseWsMessage;
class ProfileReadProfile extends BaseWsMessage
{
public $Version;

public $UniqueID;

public $ReadRequests;


public function __construct($options)
{
if (!is_null($options)) {
$this->Version= $options->Version;
$this->UniqueID= $options->UniqueID;
$this->ReadRequests= $options->ReadRequests;
}
}
}
23 changes: 23 additions & 0 deletions src/Amadeus/Client/Struct/Profile/ProfileUpdateProfile.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace Amadeus\Client\Struct\Profile;
use Amadeus\Client\Struct\BaseWsMessage;

class ProfileUpdateProfile extends BaseWsMessage
{
public $Position;
//public $Root;
public $UniqueID=[];
public $Version;

public function __construct($options)
{
if (!is_null($options)) {
foreach ($options as $propName => $propValue) {
if (property_exists($this, $propName)) {
$this->$propName = $propValue;
}
}
}
}
}

0 comments on commit eddff2e

Please sign in to comment.