Skip to content

Commit

Permalink
move Commands/Results to Response
Browse files Browse the repository at this point in the history
  • Loading branch information
pavarnos committed Aug 14, 2018
1 parent f14b967 commit 535b2e3
Show file tree
Hide file tree
Showing 28 changed files with 57 additions and 58 deletions.
2 changes: 1 addition & 1 deletion src/Threema/Console/Symfony/AbstractNetworkedCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Threema\MsgApi\Commands\Results\Response;
use Threema\MsgApi\Connection;
use Threema\MsgApi\Constants;
use Threema\MsgApi\Exceptions\Exception;
use Threema\MsgApi\Exceptions\InvalidArgumentException;
use Threema\MsgApi\Response\Response;

abstract class AbstractNetworkedCommand extends AbstractLocalCommand
{
Expand Down
4 changes: 2 additions & 2 deletions src/Threema/MsgApi/Commands/Capability.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

namespace Threema\MsgApi\Commands;

use Threema\MsgApi\Commands\Results\CapabilityResponse;
use Threema\MsgApi\Commands\Results\Response;
use Threema\MsgApi\Response\CapabilityResponse;
use Threema\MsgApi\Response\Response;

class Capability implements CommandInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/Threema/MsgApi/Commands/CommandInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace Threema\MsgApi\Commands;

use Threema\MsgApi\Commands\Results\Response;
use Threema\MsgApi\Response\Response;

interface CommandInterface
{
Expand Down
4 changes: 2 additions & 2 deletions src/Threema/MsgApi/Commands/Credits.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

namespace Threema\MsgApi\Commands;

use Threema\MsgApi\Commands\Results\CreditsResponse;
use Threema\MsgApi\Commands\Results\Response;
use Threema\MsgApi\Response\CreditsResponse;
use Threema\MsgApi\Response\Response;

class Credits implements CommandInterface
{
Expand Down
4 changes: 2 additions & 2 deletions src/Threema/MsgApi/Commands/DownloadFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

namespace Threema\MsgApi\Commands;

use Threema\MsgApi\Commands\Results\DownloadFileResponse;
use Threema\MsgApi\Commands\Results\Response;
use Threema\MsgApi\Response\DownloadFileResponse;
use Threema\MsgApi\Response\Response;

class DownloadFile implements CommandInterface
{
Expand Down
4 changes: 2 additions & 2 deletions src/Threema/MsgApi/Commands/FetchPublicKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace Threema\MsgApi\Commands;

use Threema\MsgApi\Commands\Results\FetchPublicKeyResponse;
use Threema\MsgApi\Response\FetchPublicKeyResponse;

class FetchPublicKey implements CommandInterface
{
Expand Down Expand Up @@ -46,7 +46,7 @@ public function getPath(): string
* @param string $response
* @return FetchPublicKeyResponse
*/
public function parseResult(int $httpCode, string $response): \Threema\MsgApi\Commands\Results\Response
public function parseResult(int $httpCode, string $response): \Threema\MsgApi\Response\Response
{
return new FetchPublicKeyResponse($httpCode, $response);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Threema/MsgApi/Commands/LookupBulk.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

namespace Threema\MsgApi\Commands;

use Threema\MsgApi\Commands\Results\LookupBulkResponse;
use Threema\MsgApi\Commands\Results\Response;
use Threema\MsgApi\Encryptor\AbstractEncryptor;
use Threema\MsgApi\Response\LookupBulkResponse;
use Threema\MsgApi\Response\Response;

/**
* It is possible (though very unlikely) that two different phone numbers or emails will hash to the same value.
Expand Down
4 changes: 2 additions & 2 deletions src/Threema/MsgApi/Commands/LookupEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

namespace Threema\MsgApi\Commands;

use Threema\MsgApi\Commands\Results\LookupIdResponse;
use Threema\MsgApi\Commands\Results\Response;
use Threema\MsgApi\Response\LookupIdResponse;
use Threema\MsgApi\Response\Response;

class LookupEmail implements CommandInterface
{
Expand Down
4 changes: 2 additions & 2 deletions src/Threema/MsgApi/Commands/LookupPhone.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

namespace Threema\MsgApi\Commands;

use Threema\MsgApi\Commands\Results\LookupIdResponse;
use Threema\MsgApi\Commands\Results\Response;
use Threema\MsgApi\Response\LookupIdResponse;
use Threema\MsgApi\Response\Response;

class LookupPhone implements CommandInterface
{
Expand Down
4 changes: 2 additions & 2 deletions src/Threema/MsgApi/Commands/SendE2E.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

namespace Threema\MsgApi\Commands;

use Threema\MsgApi\Commands\Results\Response;
use Threema\MsgApi\Commands\Results\SendE2EResponse;
use Threema\MsgApi\Response\Response;
use Threema\MsgApi\Response\SendE2EResponse;

class SendE2E implements CommandInterface
{
Expand Down
4 changes: 2 additions & 2 deletions src/Threema/MsgApi/Commands/SendSimple.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace Threema\MsgApi\Commands;

use Threema\MsgApi\Commands\Results\SendSimpleResponse;
use Threema\MsgApi\Response\SendSimpleResponse;

class SendSimple implements CommandInterface
{
Expand Down Expand Up @@ -74,7 +74,7 @@ public function getPath(): string
* @param string $response
* @return SendSimpleResponse
*/
public function parseResult(int $httpCode, string $response): \Threema\MsgApi\Commands\Results\Response
public function parseResult(int $httpCode, string $response): \Threema\MsgApi\Response\Response
{
return new SendSimpleResponse($httpCode, $response);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Threema/MsgApi/Commands/UploadFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

namespace Threema\MsgApi\Commands;

use Threema\MsgApi\Commands\Results\Response;
use Threema\MsgApi\Commands\Results\UploadFileResponse;
use Threema\MsgApi\Response\Response;
use Threema\MsgApi\Response\UploadFileResponse;

class UploadFile implements MultiPartCommandInterface
{
Expand Down
24 changes: 12 additions & 12 deletions src/Threema/MsgApi/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,22 @@
use Threema\MsgApi\Commands\LookupBulk;
use Threema\MsgApi\Commands\LookupEmail;
use Threema\MsgApi\Commands\LookupPhone;
use Threema\MsgApi\Commands\Results\CapabilityResponse;
use Threema\MsgApi\Commands\Results\CreditsResponse;
use Threema\MsgApi\Commands\Results\DownloadFileResponse;
use Threema\MsgApi\Commands\Results\FetchPublicKeyResponse;
use Threema\MsgApi\Commands\Results\LookupBulkResponse;
use Threema\MsgApi\Commands\Results\LookupIdResponse;
use Threema\MsgApi\Commands\Results\SendE2EResponse;
use Threema\MsgApi\Commands\Results\SendSimpleResponse;
use Threema\MsgApi\Commands\Results\UploadFileResponse;
use Threema\MsgApi\Commands\SendE2E;
use Threema\MsgApi\Commands\SendSimple;
use Threema\MsgApi\Commands\UploadFile;
use Threema\MsgApi\Encryptor\AbstractEncryptor;
use Threema\MsgApi\Helpers\E2EHelper;
use Threema\MsgApi\Helpers\ReceiveMessageResult;
use Threema\MsgApi\HttpDriver\HttpDriverInterface;
use Threema\MsgApi\Response\CapabilityResponse;
use Threema\MsgApi\Response\CreditsResponse;
use Threema\MsgApi\Response\DownloadFileResponse;
use Threema\MsgApi\Response\FetchPublicKeyResponse;
use Threema\MsgApi\Response\LookupBulkResponse;
use Threema\MsgApi\Response\LookupIdResponse;
use Threema\MsgApi\Response\SendE2EResponse;
use Threema\MsgApi\Response\SendSimpleResponse;
use Threema\MsgApi\Response\UploadFileResponse;

/**
* talk to the Threema Gateway server via the HttpDriverInterface
Expand Down Expand Up @@ -182,7 +182,7 @@ public function fetchPublicKey(string $threemaId): FetchPublicKeyResponse
* @param string $toThreemaId
* @param string $toPublicKeyHex
* @param string $text
* @return \Threema\MsgApi\Commands\Results\SendE2EResponse
* @return \Threema\MsgApi\Response\SendE2EResponse
* @throws \Threema\MsgApi\Exceptions\Exception
*/
public function sendTextMessage(string $myPrivateKeyHex, string $toThreemaId, string $toPublicKeyHex,
Expand All @@ -199,7 +199,7 @@ public function sendTextMessage(string $myPrivateKeyHex, string $toThreemaId, st
* @param string $toThreemaId
* @param string $toPublicKeyHex
* @param string $imagePath
* @return \Threema\MsgApi\Commands\Results\SendE2EResponse
* @return \Threema\MsgApi\Response\SendE2EResponse
* @throws \Threema\MsgApi\Exceptions\Exception
*/
public function sendImageMessage(string $myPrivateKeyHex, string $toThreemaId, string $toPublicKeyHex,
Expand All @@ -217,7 +217,7 @@ public function sendImageMessage(string $myPrivateKeyHex, string $toThreemaId, s
* @param string $toPublicKeyHex
* @param string $filePath
* @param string $thumbnailPath
* @return \Threema\MsgApi\Commands\Results\SendE2EResponse
* @return \Threema\MsgApi\Response\SendE2EResponse
* @throws \Threema\MsgApi\Exceptions\Exception
*/
public final function sendFileMessage(string $myPrivateKeyHex, string $toThreemaId, string $toPublicKeyHex,
Expand Down
4 changes: 2 additions & 2 deletions src/Threema/MsgApi/Encryptor/AbstractEncryptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@

namespace Threema\MsgApi\Encryptor;

use Threema\MsgApi\Commands\Results\UploadFileResponse;
use Threema\MsgApi\Exceptions\BadMessageException;
use Threema\MsgApi\Exceptions\DecryptionFailedException;
use Threema\MsgApi\Exceptions\UnsupportedMessageTypeException;
use Threema\MsgApi\Helpers\AssocArray;
use Threema\MsgApi\Helpers\EncryptResult;
use Threema\MsgApi\Helpers\FileAnalysisResult;
use Threema\MsgApi\Helpers\KeyPair;
use Threema\MsgApi\Message\AbstractMessage;
use Threema\MsgApi\Message\DeliveryReceipt;
use Threema\MsgApi\Message\FileMessage;
use Threema\MsgApi\Message\ImageMessage;
use Threema\MsgApi\Message\TextMessage;
use Threema\MsgApi\Message\AbstractMessage;
use Threema\MsgApi\Response\UploadFileResponse;

/**
* Contains static methods to do various Threema cryptography related tasks.
Expand Down
16 changes: 8 additions & 8 deletions src/Threema/MsgApi/Helpers/E2EHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@

namespace Threema\MsgApi\Helpers;

use Threema\MsgApi\Commands\Results\CapabilityResponse;
use Threema\MsgApi\Commands\Results\DownloadFileResponse;
use Threema\MsgApi\Commands\Results\SendE2EResponse;
use Threema\MsgApi\Connection;
use Threema\MsgApi\Encryptor\AbstractEncryptor;
use Threema\MsgApi\Exceptions\DecryptionFailedException;
use Threema\MsgApi\Exceptions\HttpException;
use Threema\MsgApi\Exceptions\InvalidArgumentException;
use Threema\MsgApi\Exceptions\UnsupportedMessageTypeException;
use Threema\MsgApi\Message\AbstractMessage;
use Threema\MsgApi\Message\FileMessage;
use Threema\MsgApi\Message\ImageMessage;
use Threema\MsgApi\Message\AbstractMessage;
use Threema\MsgApi\Response\CapabilityResponse;
use Threema\MsgApi\Response\DownloadFileResponse;
use Threema\MsgApi\Response\SendE2EResponse;

/**
* Splits some of the bulky code out of the Connection class to keep the Connection small / clean
Expand Down Expand Up @@ -59,7 +59,7 @@ public function __construct(string $privateKeyBinary, Connection $connection, Ab
* @param string $threemaId
* @param string $receiverPublicKey binary format
* @param string $text
* @return \Threema\MsgApi\Commands\Results\SendE2EResponse
* @return \Threema\MsgApi\Response\SendE2EResponse
* @throws \Threema\MsgApi\Exceptions\Exception
*/
public final function sendTextMessage(string $threemaId, string $receiverPublicKey, string $text): SendE2EResponse
Expand All @@ -83,7 +83,7 @@ public final function sendTextMessage(string $threemaId, string $receiverPublicK
* @param string $threemaId
* @param string $receiverPublicKey binary format
* @param string $imagePath
* @return \Threema\MsgApi\Commands\Results\SendE2EResponse
* @return \Threema\MsgApi\Response\SendE2EResponse
* @throws \Threema\MsgApi\Exceptions\Exception
*/
public final function sendImageMessage(string $threemaId, string $receiverPublicKey,
Expand Down Expand Up @@ -130,7 +130,7 @@ public final function sendImageMessage(string $threemaId, string $receiverPublic
* @param string $receiverPublicKey binary format
* @param string $filePath
* @param string $thumbnailPath
* @return \Threema\MsgApi\Commands\Results\SendE2EResponse
* @return \Threema\MsgApi\Response\SendE2EResponse
* @throws \Threema\MsgApi\Exceptions\Exception
*/
public final function sendFileMessage(string $threemaId, string $receiverPublicKey, string $filePath,
Expand Down Expand Up @@ -322,7 +322,7 @@ private function assertIsCapable(string $threemaId, string $wantedCapability)
* @param AbstractMessage $message
* @param string $blobId blob id as hex
* @param \Closure $shouldDownload
* @return null|\Threema\MsgApi\Commands\Results\DownloadFileResponse
* @return null|\Threema\MsgApi\Response\DownloadFileResponse
* @throws \Threema\MsgApi\Exceptions\HttpException
*/
private function downloadFile(AbstractMessage $message, $blobId, \Closure $shouldDownload): ?DownloadFileResponse
Expand Down
2 changes: 1 addition & 1 deletion src/Threema/MsgApi/HttpDriver/CurlHttpDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
use Threema\MsgApi\Commands\CommandInterface;
use Threema\MsgApi\Commands\JsonCommandInterface;
use Threema\MsgApi\Commands\MultiPartCommandInterface;
use Threema\MsgApi\Commands\Results\Response;
use Threema\MsgApi\Constants;
use Threema\MsgApi\Exceptions\HttpException;
use Threema\MsgApi\Helpers\Url;
use Threema\MsgApi\Response\Response;

/**
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Threema/MsgApi/HttpDriver/HttpDriverInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Threema\MsgApi\Commands\CommandInterface;
use Threema\MsgApi\Commands\JsonCommandInterface;
use Threema\MsgApi\Commands\MultiPartCommandInterface;
use Threema\MsgApi\Commands\Results\Response;
use Threema\MsgApi\Response\Response;

/**
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

declare(strict_types=1);

namespace Threema\MsgApi\Commands\Results;
namespace Threema\MsgApi\Response;

class CapabilityResponse extends Response
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

declare(strict_types=1);

namespace Threema\MsgApi\Commands\Results;
namespace Threema\MsgApi\Response;

class CreditsResponse extends Response
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

declare(strict_types=1);

namespace Threema\MsgApi\Commands\Results;
namespace Threema\MsgApi\Response;

class DownloadFileResponse extends Response
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

declare(strict_types=1);

namespace Threema\MsgApi\Commands\Results;
namespace Threema\MsgApi\Response;

class FetchPublicKeyResponse extends Response
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

declare(strict_types=1);

namespace Threema\MsgApi\Commands\Results;
namespace Threema\MsgApi\Response;

use Threema\MsgApi\Commands\LookupBulk;
use Threema\MsgApi\Helpers\BulkLookupIdentity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

declare(strict_types=1);

namespace Threema\MsgApi\Commands\Results;
namespace Threema\MsgApi\Response;

class LookupIdResponse extends Response
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

declare(strict_types=1);

namespace Threema\MsgApi\Commands\Results;
namespace Threema\MsgApi\Response;

abstract class Response
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

declare(strict_types=1);

namespace Threema\MsgApi\Commands\Results;
namespace Threema\MsgApi\Response;

class SendE2EResponse extends Response
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

declare(strict_types=1);

namespace Threema\MsgApi\Commands\Results;
namespace Threema\MsgApi\Response;

class SendSimpleResponse extends Response
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

declare(strict_types=1);

namespace Threema\MsgApi\Commands\Results;
namespace Threema\MsgApi\Response;

class UploadFileResponse extends Response
{
Expand Down
Loading

0 comments on commit 535b2e3

Please sign in to comment.