├── .github ├── dependabot.yml └── workflows │ └── main.yml ├── .gitignore ├── .mergify.yml ├── LICENSE ├── README.md ├── composer.json ├── composer.lock ├── config └── Hostfact.php ├── cyclomatic.xml ├── infection.json.dist ├── phpstan.neon.dist ├── phpunit.xml.dist ├── psalm.xml ├── src ├── Api │ ├── Api.php │ ├── Capabilities │ │ ├── CanAccept.php │ │ ├── CanAdd.php │ │ ├── CanAddAttachment.php │ │ ├── CanAddLine.php │ │ ├── CanAddMessage.php │ │ ├── CanAutoRenew.php │ │ ├── CanBlock.php │ │ ├── CanCancelSchedule.php │ │ ├── CanChangeNameserver.php │ │ ├── CanChangeOwner.php │ │ ├── CanChangeStatus.php │ │ ├── CanCheck.php │ │ ├── CanCheckLogin.php │ │ ├── CanCreate.php │ │ ├── CanCredit.php │ │ ├── CanDecline.php │ │ ├── CanDelete.php │ │ ├── CanDeleteAttachment.php │ │ ├── CanDeleteLine.php │ │ ├── CanDownload.php │ │ ├── CanDownloadAccountData.php │ │ ├── CanDownloadAttachment.php │ │ ├── CanEdit.php │ │ ├── CanEditDnsZone.php │ │ ├── CanEditWhois.php │ │ ├── CanEmailAccountData.php │ │ ├── CanGeneratePdf.php │ │ ├── CanGetDnsZone.php │ │ ├── CanGetDomainList.php │ │ ├── CanGetStatus.php │ │ ├── CanGetToken.php │ │ ├── CanList.php │ │ ├── CanListDnsTemplates.php │ │ ├── CanListDomain.php │ │ ├── CanLock.php │ │ ├── CanMarkAsInstalled.php │ │ ├── CanMarkAsPaid.php │ │ ├── CanMarkAsUninstalled.php │ │ ├── CanMarkAsUnpaid.php │ │ ├── CanPause.php │ │ ├── CanPayPartial.php │ │ ├── CanPaymentProcessPause.php │ │ ├── CanPaymentProcessReactivate.php │ │ ├── CanProcess.php │ │ ├── CanRegister.php │ │ ├── CanReissue.php │ │ ├── CanRemoveFromServer.php │ │ ├── CanRenew.php │ │ ├── CanRequest.php │ │ ├── CanResendApproverEmail.php │ │ ├── CanRestart.php │ │ ├── CanRevoke.php │ │ ├── CanSchedule.php │ │ ├── CanSendByEmail.php │ │ ├── CanSendEmail.php │ │ ├── CanSendReminderByEmail.php │ │ ├── CanSendSummationByEmail.php │ │ ├── CanShow.php │ │ ├── CanStart.php │ │ ├── CanSuspend.php │ │ ├── CanSyncWhois.php │ │ ├── CanTerminate.php │ │ ├── CanTransfer.php │ │ ├── CanUnblock.php │ │ ├── CanUnlock.php │ │ ├── CanUnsuspend.php │ │ ├── CanUpDowngrade.php │ │ └── CanUpdateLoginCredentials.php │ └── Controllers │ │ ├── CreditInvoice.php │ │ ├── Creditor.php │ │ ├── Debtor.php │ │ ├── Domain.php │ │ ├── Group.php │ │ ├── Handle.php │ │ ├── Hosting.php │ │ ├── Invoice.php │ │ ├── Order.php │ │ ├── PriceQuote.php │ │ ├── Product.php │ │ ├── Service.php │ │ ├── Ssl.php │ │ ├── Ticket.php │ │ └── Vps.php ├── Exceptions │ └── InvalidArgumentException.php ├── HostfactFacade.php ├── Http │ └── HttpClient.php ├── Interfaces │ ├── ApiInterface.php │ ├── CreditInvoiceInterface.php │ ├── CreditorInterface.php │ ├── DebtorInterface.php │ ├── DomainInterface.php │ ├── FormParameterInterface.php │ ├── GroupInterface.php │ ├── HandleInterface.php │ ├── HostingInterface.php │ ├── HttpClientInterface.php │ ├── InvoiceInterface.php │ ├── OrderInterface.php │ ├── PriceQuoteInterface.php │ ├── ProductInterface.php │ ├── ServiceInterface.php │ ├── SslInterface.php │ ├── TicketInterface.php │ └── VpsInterface.php ├── Providers │ └── HostfactServiceProvider.php └── Types │ ├── FormParameter.php │ └── Url.php └── tests ├── Feature └── ControllerTest.php └── Unit └── HostfactApiClientTest.php /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | --- 2 | version: 2 3 | updates: 4 | - package-ecosystem: composer 5 | directory: "/" 6 | schedule: 7 | interval: weekly 8 | time: "08:00" 9 | open-pull-requests-limit: 10 10 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Run tests 3 | 4 | on: 5 | - push 6 | 7 | jobs: 8 | unit-tests: 9 | strategy: 10 | fail-fast: false 11 | matrix: 12 | php: 13 | - 8.1 14 | - 8.2 15 | dependency-version: 16 | # - prefer-lowest 17 | - prefer-stable 18 | os: 19 | - ubuntu-latest 20 | test: 21 | - test-github 22 | 23 | name: ${{ matrix.test }} on PHP${{ matrix.php }} with ${{ matrix.dependency-version }} on ${{ matrix.os }} 24 | runs-on: ${{ matrix.os }} 25 | steps: 26 | - name: Checkout code 27 | uses: actions/checkout@v1 28 | - name: Setup PHP 29 | uses: shivammathur/setup-php@v2 30 | with: 31 | php-version: ${{ matrix.php }} 32 | extensions: curl, json 33 | coverage: pcov 34 | - name: Composer self-update 35 | run: | 36 | composer self-update 37 | - name: Composer update 38 | run: | 39 | composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest 40 | - name: Composer ${{ matrix.test }}-${{ matrix.os }} 41 | run: | 42 | composer ${{ matrix.test }} 43 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /vendor/ 2 | /.idea/ 3 | clover.xml 4 | .phpunit.result.cache 5 | -------------------------------------------------------------------------------- /.mergify.yml: -------------------------------------------------------------------------------- 1 | pull_request_rules: 2 | - name: automatic approval for Dependabot pull requests 3 | conditions: 4 | - author=dependabot[bot] 5 | actions: 6 | review: 7 | type: APPROVE 8 | message: Automatically approving dependabot 9 | 10 | - name: automatic merge on depenabot pull requests 11 | conditions: 12 | - author=dependabot[bot] 13 | - check-success~=^test* 14 | actions: 15 | merge: 16 | method: merge 17 | 18 | - name: delete head branch after merge 19 | conditions: 20 | - merged 21 | actions: 22 | delete_head_branch: 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2105 Gerben Geijteman 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Hostfact API 3.0 for Laravel 2 | 3 | [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fhyperized%2Fhostfact.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fhyperized%2Fhostfact?ref=badge_shield) 4 | 5 | Official documentation: 6 | ----------------------- 7 | 8 | * [Hostfact API documentation](https://www.hostfact.nl/developer/api/) 9 | 10 | Installation 11 | ------------ 12 | 13 | Install using composer: 14 | 15 | ```bash 16 | composer require hyperized/hostfact 17 | ``` 18 | 19 | This package supports Package Auto-Discovery (Laravel 5.5+) so it doesn't require you to manually add the 20 | ServiceProvider and alias. 21 | 22 | If you are using a lower version of Laravel or not using Auto-Discovery you can add the Hostfact Service Provider to 23 | the `config/app.php` file 24 | 25 | ```php 26 | Hyperized\Hostfact\HostfactServiceProvider::class, 27 | ``` 28 | 29 | Register an alias for Hostfact, also in `config/app.php`: 30 | 31 | ```php 32 | 'Hostfact' => Hyperized\Hostfact\HostfactServiceProvider::class, 33 | ``` 34 | 35 | Now publish the Hostfact package into your installation: 36 | 37 | ```bash 38 | php artisan vendor:publish --provider="Hyperized\Hostfact\HostfactServiceProvider" --tag="config" 39 | ``` 40 | 41 | This should give you a message 42 | like: `Copied File [/vendor/hyperized/hostfact/config/Hostfact.php] To [/config/Hostfact.php]` 43 | 44 | It's possible to edit your configuration variables in the `config/Hostfact.php` file or you can use the `HOSTFACT_URL` 45 | and `HOSTFACT_KEY` environment variables to store sensitive information in the `.env` file 46 | 47 | ```php 48 | // config/Hostfact.php 49 | 'api_v2_url' => env('HOSTFACT_URL', 'https://yoursite.tld/Pro/apiv2/api.php'), 50 | 'api_v2_key' => env('HOSTFACT_KEY', 'token'), 51 | 'api_v2_timeout' => env('HOSTFACT_TIMEOUT', 20), 52 | 53 | // .env/.env.example 54 | HOSTFACT_URL=https://yoursite.tld/Pro/apiv2/api.php 55 | HOSTFACT_KEY=token 56 | HOSTFACT_TIMEOUT=20 57 | ``` 58 | 59 | Functionality 60 | --------- 61 | 62 | When writing code for this Hostfact package, consider that this package has been written as a basic interface. 63 | 64 | This package _will_ do the following: 65 | 66 | * Provide an easy way to communicate with Hostfact API controllers; 67 | * Document the available API controller endpoints with methods; 68 | * Transport layer (HTTP/HTTPS) error catching; 69 | * Basic error parsing; 70 | 71 | This package _will not_: 72 | 73 | * Parameter / input validation; 74 | * Output validation; 75 | 76 | You will need to consult the [Hostfact API documentation](https://www.hostfact.nl/developer/api/) to understand the 77 | acceptable input and output for each of the API controllers. 78 | 79 | Examples 80 | -------- 81 | 82 | Example code: 83 | 84 | ```php 85 | use \Hyperized\Hostfact\Api\Controllers\Product; 86 | 87 | $products = Product::new() 88 | ->list([ 89 | 'searchfor' => 'invoice' 90 | ]); 91 | ``` 92 | 93 | ## License 94 | 95 | [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fhyperized%2Fhostfact.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fhyperized%2Fhostfact?ref=badge_large) -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hyperized/hostfact", 3 | "description": "Hostfact 3.0 API Implementation for Laravel", 4 | "keywords": [ 5 | "hyperized", 6 | "hostfact", 7 | "api" 8 | ], 9 | "type": "library", 10 | "minimum-stability": "stable", 11 | "license": "MIT", 12 | "authors": [ 13 | { 14 | "name": "Gerben Geijteman", 15 | "email": "gerben@hyperized.net" 16 | } 17 | ], 18 | "require": { 19 | "php": "^8.1", 20 | "guzzlehttp/guzzle": "^7.5", 21 | "hyperized/value-objects": "^0.3.0", 22 | "thecodingmachine/safe": "^2.4" 23 | }, 24 | "require-dev": { 25 | "phpunit/phpunit": "^9.5", 26 | "phpmd/phpmd": "^2.13", 27 | "vimeo/psalm": "^5.1", 28 | "orchestra/testbench": "^7.15 || ^8.0", 29 | "phpstan/phpstan": "^1.9", 30 | "squizlabs/php_codesniffer": "^3.7", 31 | "povils/phpmnd": "^3.0", 32 | "infection/infection": "^0.26.16 || ^0.27.0" 33 | }, 34 | "autoload": { 35 | "psr-4": { 36 | "Hyperized\\Hostfact\\": "src/" 37 | } 38 | }, 39 | "autoload-dev": { 40 | "psr-4": { 41 | "Hyperized\\Hostfact\\Tests\\": "tests/" 42 | } 43 | }, 44 | "extra": { 45 | "laravel": { 46 | "providers": [ 47 | "Hyperized\\Hostfact\\Providers\\HostfactServiceProvider" 48 | ], 49 | "aliases": { 50 | "Hostfact": "Hyperized\\Hostfact\\Providers\\HostfactServiceProvider" 51 | } 52 | } 53 | }, 54 | "scripts": { 55 | "test": [ 56 | "@phpmd --version", 57 | "@phpmd --strict src text cyclomatic.xml", 58 | "@psalm --version", 59 | "@psalm", 60 | "@phpstan --version", 61 | "@phpstan analyse", 62 | "@phpcbf --version", 63 | "@phpcbf src", 64 | "@phpcs --version", 65 | "@phpcs src --standard=PSR2", 66 | "@phpmnd --version", 67 | "@phpmnd src", 68 | "@phpunit --version", 69 | "@phpunit --configuration phpunit.xml.dist", 70 | "@infection --version", 71 | "@infection" 72 | ], 73 | "test-github": [ 74 | "@test" 75 | ], 76 | "phpunit": "vendor/phpunit/phpunit/phpunit", 77 | "phpmd": "vendor/bin/phpmd", 78 | "psalm": "vendor/bin/psalm", 79 | "phpstan": "vendor/bin/phpstan", 80 | "phpcs": "vendor/bin/phpcs", 81 | "phpcbf": "vendor/bin/phpcbf", 82 | "phpmnd": "vendor/bin/phpmnd src", 83 | "infection": "vendor/bin/infection", 84 | "major": [ 85 | "composer update", 86 | "@update-major", 87 | "@update-major-dev" 88 | ], 89 | "update-major": "jq -r '.require | keys[]' composer.json | xargs composer require --update-with-all-dependencies", 90 | "update-major-dev": "jq -r '.\"require-dev\" | keys[]' composer.json | xargs composer require --dev --update-with-all-dependencies" 91 | }, 92 | "config": { 93 | "allow-plugins": { 94 | "composer/package-versions-deprecated": true, 95 | "infection/extension-installer": true 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /config/Hostfact.php: -------------------------------------------------------------------------------- 1 | env('HOSTFACT_URL'), 8 | 9 | // Token provided as 'Beveiligingscode' 10 | 'api_v2_key' => env('HOSTFACT_KEY'), 11 | 12 | // Timeout in seconds 13 | 'api_v2_timeout' => env('HOSTFACT_TIMEOUT', 20), 14 | ]; 15 | -------------------------------------------------------------------------------- /cyclomatic.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | Checks for Cyclomatic complexity 11 | 12 | 13 | 14 | 15 | 1 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /infection.json.dist: -------------------------------------------------------------------------------- 1 | { 2 | "timeout": 10, 3 | "source": { 4 | "directories": [ 5 | "src" 6 | ] 7 | }, 8 | "logs": { 9 | "text": "infection.log" 10 | }, 11 | "mutators": { 12 | "@default": true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /phpstan.neon.dist: -------------------------------------------------------------------------------- 1 | parameters: 2 | level: 9 3 | paths: 4 | - src 5 | -------------------------------------------------------------------------------- /phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | src/ 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | ./tests/ 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /psalm.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/Api/Api.php: -------------------------------------------------------------------------------- 1 | httpClient = $httpClient; 25 | } 26 | 27 | /** 28 | * @return RequestInterface 29 | * 30 | * uri will be filled in with HTTPClient uri 31 | * Body will be empty as this client only sends form parameters via POST 32 | */ 33 | public static function getRequest(): RequestInterface 34 | { 35 | return new Request('POST', '', [], Utils::streamFor()); 36 | } 37 | 38 | /** 39 | * @param HttpClientInterface $client 40 | * @param RequestInterface $request 41 | * @param FormParameterInterface $formParameter 42 | * @param string $controller 43 | * @param string $action 44 | * @return ResponseInterface 45 | * 46 | * This method slipstreams the api_key and controller information into the form parameters 47 | */ 48 | public static function getResponse( 49 | HttpClientInterface $client, 50 | RequestInterface $request, 51 | FormParameterInterface $formParameter, 52 | string $controller, 53 | string $action 54 | ): ResponseInterface { 55 | try { 56 | return $client 57 | ->getHttpClient() 58 | ->send( 59 | $request, 60 | [ 61 | 'form_params' => array_merge( 62 | $formParameter->toArray(), 63 | [ 64 | 'api_key' => config('Hostfact.api_v2_key'), 65 | 'controller' => $controller, 66 | 'action' => $action, 67 | ] 68 | ), 69 | ] 70 | ); 71 | } catch (GuzzleException $exception) { 72 | throw InvalidArgumentException::apiFailed($exception); 73 | } 74 | } 75 | 76 | public static function getResponseBody(ResponseInterface $response): string 77 | { 78 | return $response 79 | ->getBody() 80 | ->getContents(); 81 | } 82 | 83 | public function getHttpClient(): HttpClientInterface 84 | { 85 | return $this->httpClient; 86 | } 87 | 88 | /** 89 | * @param string $controller 90 | * @param string $action 91 | * @param array $input 92 | * @return array 93 | */ 94 | public function sendRequest(string $controller, string $action, array $input): array 95 | { 96 | try { 97 | /** 98 | * @var array $result 99 | */ 100 | $result = \Safe\json_decode( 101 | static::getResponseBody( 102 | static::getResponse( 103 | $this->getHttpClient(), 104 | static::getRequest(), 105 | FormParameter::fromArray($input), 106 | $controller, 107 | $action 108 | ) 109 | ), 110 | true 111 | ); 112 | } catch (JsonException $exception) { 113 | $result = [ 114 | 'controller' => 'invalid', 115 | 'action' => 'invalid', 116 | 'status' => 'error', 117 | 'date' => date('c'), 118 | 'errors' => [ 119 | $exception 120 | ] 121 | ]; 122 | } 123 | 124 | return $result; 125 | } 126 | 127 | public static function getUrlFromConfig(): string 128 | { 129 | $url = config('Hostfact.api_v2_url'); 130 | if (!is_string($url)) { 131 | throw InvalidArgumentException::configVariableNotAString(); 132 | } 133 | return $url; 134 | } 135 | } 136 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanAccept.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function accept(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | __FUNCTION__, 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanAdd.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function add(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | __FUNCTION__, 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanAddAttachment.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function attachmentAdd(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | 'attachment_add', 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanAddLine.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function lineAdd(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | mb_strtolower(self::$name) . 'line_add', 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanAddMessage.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function addMessage(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | mb_strtolower(__FUNCTION__), 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanAutoRenew.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function autoRenew(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | mb_strtolower(__FUNCTION__), 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanBlock.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function block(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | __FUNCTION__, 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanCancelSchedule.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function cancelSchedule(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | mb_strtolower(__FUNCTION__), 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanChangeNameserver.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function changeNameserver(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | mb_strtolower(__FUNCTION__), 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanChangeOwner.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function changeOwner(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | mb_strtolower(__FUNCTION__), 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanChangeStatus.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function changeStatus(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | mb_strtolower(__FUNCTION__), 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanCheck.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function check(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | __FUNCTION__, 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanCheckLogin.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function checkLogin(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | mb_strtolower(__FUNCTION__), 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanCreate.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function create(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | __FUNCTION__, 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanCredit.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function credit(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | __FUNCTION__, 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanDecline.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function decline(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | __FUNCTION__, 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanDelete.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function delete(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | __FUNCTION__, 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanDeleteAttachment.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function attachmentDelete(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | 'attachment_delete', 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanDeleteLine.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function lineDelete(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | mb_strtolower(self::$name) . 'line_delete', 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanDownload.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function download(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | __FUNCTION__, 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanDownloadAccountData.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function downloadAccountData(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | 'downloadaccountdata', 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanDownloadAttachment.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function attachmentDownload(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | 'attachment_download', 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanEdit.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function edit(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | __FUNCTION__, 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanEditDnsZone.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function editDnsZone(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | mb_strtolower(__FUNCTION__), 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanEditWhois.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function editWhois(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | mb_strtolower(__FUNCTION__), 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanEmailAccountData.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function emailAccountData(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | 'sendaccountdatabyemail', 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanGeneratePdf.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function generatePdf(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | mb_strtolower(__FUNCTION__), 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanGetDnsZone.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function getDnsZone(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | mb_strtolower(__FUNCTION__), 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanGetDomainList.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function getDomainList(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | mb_strtolower(__FUNCTION__), 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanGetStatus.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function getStatus(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | mb_strtolower(__FUNCTION__), 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanGetToken.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function getToken(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | mb_strtolower(__FUNCTION__), 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanList.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function list(array $input = []): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | __FUNCTION__, 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanListDnsTemplates.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function listDnsTemplates(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | mb_strtolower(__FUNCTION__), 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanListDomain.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function listDomain(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | mb_strtolower(__FUNCTION__), 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanLock.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function lock(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | __FUNCTION__, 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanMarkAsInstalled.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function markAsInstalled(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | 'installed', 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanMarkAsPaid.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function markAsPaid(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | mb_strtolower(__FUNCTION__), 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanMarkAsUninstalled.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function markAsUninstalled(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | 'uninstalled', 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanMarkAsUnpaid.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function markAsUnpaid(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | mb_strtolower(__FUNCTION__), 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanPause.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function pause(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | __FUNCTION__, 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanPayPartial.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function partialPayment(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | 'partpayment', 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanPaymentProcessPause.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function paymentProcessPause(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | 'payment_process_pause', 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanPaymentProcessReactivate.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function paymentProcessReactivate(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | 'payment_process_reactivate', 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanProcess.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function process(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | __FUNCTION__, 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanRegister.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function register(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | __FUNCTION__, 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanReissue.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function reissue(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | __FUNCTION__, 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanRemoveFromServer.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function removeFromServer(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | mb_strtolower(__FUNCTION__), 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanRenew.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function renew(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | __FUNCTION__, 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanRequest.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function request(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | __FUNCTION__, 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanResendApproverEmail.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function resendApproverEmail(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | mb_strtolower(__FUNCTION__), 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanRestart.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function restart(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | __FUNCTION__, 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanRevoke.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function revoke(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | __FUNCTION__, 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanSchedule.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function schedule(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | __FUNCTION__, 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanSendByEmail.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function sendByEmail(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | mb_strtolower(__FUNCTION__), 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanSendEmail.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function sendEmail(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | mb_strtolower(__FUNCTION__), 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanSendReminderByEmail.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function sendReminderByEmail(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | mb_strtolower(__FUNCTION__), 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanSendSummationByEmail.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function sendSummationByEmail(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | mb_strtolower(__FUNCTION__), 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanShow.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function show(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | __FUNCTION__, 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanStart.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function start(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | __FUNCTION__, 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanSuspend.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function suspend(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | __FUNCTION__, 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanSyncWhois.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function syncWhois(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | mb_strtolower(__FUNCTION__), 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanTerminate.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function terminate(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | __FUNCTION__, 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanTransfer.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function transfer(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | __FUNCTION__, 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanUnblock.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function unblock(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | __FUNCTION__, 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanUnlock.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function unlock(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | __FUNCTION__, 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanUnsuspend.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function unsuspend(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | __FUNCTION__, 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanUpDowngrade.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function upDowngrade(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | mb_strtolower(__FUNCTION__), 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Capabilities/CanUpdateLoginCredentials.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function updateLoginCredentials(array $input): array 12 | { 13 | return $this 14 | ->sendRequest( 15 | self::$name, 16 | mb_strtolower(__FUNCTION__), 17 | $input 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Api/Controllers/CreditInvoice.php: -------------------------------------------------------------------------------- 1 | getMessage() . '.'); 17 | } 18 | 19 | public static function configVariableNotAString(): InvalidArgumentException 20 | { 21 | return new self('Provided config field is not a string'); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/HostfactFacade.php: -------------------------------------------------------------------------------- 1 | stack = HandlerStack::create(); 19 | $this->httpClient = (new GuzzleClient( 20 | [ 21 | 'handler' => $this->stack, 22 | 'base_uri' => $url->getValue(), 23 | 'timeout' => config('Hostfact.api_v2_timeout'), 24 | 'headers' => [ 25 | 'User-Agent' => $this->userAgent 26 | ] 27 | ] 28 | )); 29 | } 30 | 31 | public static function new(ByteArrayInterface $url): HttpClientInterface 32 | { 33 | return new HttpClient($url); 34 | } 35 | 36 | public function getHttpClient(): GuzzleClient 37 | { 38 | return $this->httpClient; 39 | } 40 | 41 | public function getStack(): HandlerStack 42 | { 43 | return $this->stack; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Interfaces/ApiInterface.php: -------------------------------------------------------------------------------- 1 | $input 34 | * @return array 35 | */ 36 | public function sendRequest(string $controller, string $action, array $input): array; 37 | } 38 | -------------------------------------------------------------------------------- /src/Interfaces/CreditInvoiceInterface.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function show(array $input): array; 12 | 13 | /** 14 | * @param array $input 15 | * @return array 16 | */ 17 | public function list(array $input = []): array; 18 | 19 | /** 20 | * @param array $input 21 | * @return array 22 | */ 23 | public function add(array $input): array; 24 | 25 | /** 26 | * @param array $input 27 | * @return array 28 | */ 29 | public function edit(array $input): array; 30 | 31 | /** 32 | * @param array $input 33 | * @return array 34 | */ 35 | public function delete(array $input): array; 36 | 37 | /** 38 | * @param array $input 39 | * @return array 40 | */ 41 | public function partialPayment(array $input): array; 42 | 43 | /** 44 | * @param array $input 45 | * @return array 46 | */ 47 | public function markAsPaid(array $input): array; 48 | 49 | /** 50 | * @param array $input 51 | * @return array 52 | */ 53 | public function lineAdd(array $input): array; 54 | 55 | /** 56 | * @param array $input 57 | * @return array 58 | */ 59 | public function lineDelete(array $input): array; 60 | 61 | /** 62 | * @param array $input 63 | * @return array 64 | */ 65 | public function attachmentAdd(array $input): array; 66 | 67 | /** 68 | * @param array $input 69 | * @return array 70 | */ 71 | public function attachmentDelete(array $input): array; 72 | 73 | /** 74 | * @param array $input 75 | * @return array 76 | */ 77 | public function attachmentDownload(array $input): array; 78 | } 79 | -------------------------------------------------------------------------------- /src/Interfaces/CreditorInterface.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function show(array $input): array; 12 | 13 | /** 14 | * @param array $input 15 | * @return array 16 | */ 17 | public function list(array $input = []): array; 18 | 19 | /** 20 | * @param array $input 21 | * @return array 22 | */ 23 | public function add(array $input): array; 24 | 25 | /** 26 | * @param array $input 27 | * @return array 28 | */ 29 | public function edit(array $input): array; 30 | 31 | /** 32 | * @param array $input 33 | * @return array 34 | */ 35 | public function delete(array $input): array; 36 | 37 | /** 38 | * @param array $input 39 | * @return array 40 | */ 41 | public function attachmentAdd(array $input): array; 42 | 43 | /** 44 | * @param array $input 45 | * @return array 46 | */ 47 | public function attachmentDelete(array $input): array; 48 | 49 | /** 50 | * @param array $input 51 | * @return array 52 | */ 53 | public function attachmentDownload(array $input): array; 54 | } 55 | -------------------------------------------------------------------------------- /src/Interfaces/DebtorInterface.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function show(array $input): array; 12 | 13 | /** 14 | * @param array $input 15 | * @return array 16 | */ 17 | public function list(array $input = []): array; 18 | 19 | /** 20 | * @param array $input 21 | * @return array 22 | */ 23 | public function add(array $input): array; 24 | 25 | /** 26 | * @param array $input 27 | * @return array 28 | */ 29 | public function edit(array $input): array; 30 | 31 | /** 32 | * @param array $input 33 | * @return array 34 | */ 35 | public function checkLogin(array $input): array; 36 | 37 | /** 38 | * @param array $input 39 | * @return array 40 | */ 41 | public function updateLoginCredentials(array $input): array; 42 | 43 | /** 44 | * @param array $input 45 | * @return array 46 | */ 47 | public function generatePdf(array $input): array; 48 | 49 | /** 50 | * @param array $input 51 | * @return array 52 | */ 53 | public function sendEmail(array $input): array; 54 | 55 | /** 56 | * @param array $input 57 | * @return array 58 | */ 59 | public function attachmentAdd(array $input): array; 60 | 61 | /** 62 | * @param array $input 63 | * @return array 64 | */ 65 | public function attachmentDelete(array $input): array; 66 | 67 | /** 68 | * @param array $input 69 | * @return array 70 | */ 71 | public function attachmentDownload(array $input): array; 72 | } 73 | -------------------------------------------------------------------------------- /src/Interfaces/DomainInterface.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function show(array $input): array; 12 | 13 | /** 14 | * @param array $input 15 | * @return array 16 | */ 17 | public function list(array $input = []): array; 18 | 19 | /** 20 | * @param array $input 21 | * @return array 22 | */ 23 | public function add(array $input): array; 24 | 25 | /** 26 | * @param array $input 27 | * @return array 28 | */ 29 | public function edit(array $input): array; 30 | 31 | /** 32 | * @param array $input 33 | * @return array 34 | */ 35 | public function terminate(array $input): array; 36 | 37 | /** 38 | * @param array $input 39 | * @return array 40 | */ 41 | public function delete(array $input): array; 42 | 43 | /** 44 | * @param array $input 45 | * @return array 46 | */ 47 | public function getToken(array $input): array; 48 | 49 | /** 50 | * @param array $input 51 | * @return array 52 | */ 53 | public function lock(array $input): array; 54 | 55 | /** 56 | * @param array $input 57 | * @return array 58 | */ 59 | public function unlock(array $input): array; 60 | 61 | /** 62 | * @param array $input 63 | * @return array 64 | */ 65 | public function changeNameserver(array $input): array; 66 | 67 | /** 68 | * @param array $input 69 | * @return array 70 | */ 71 | public function syncWhois(array $input): array; 72 | 73 | /** 74 | * @param array $input 75 | * @return array 76 | */ 77 | public function editWhois(array $input): array; 78 | 79 | /** 80 | * @param array $input 81 | * @return array 82 | */ 83 | public function check(array $input): array; 84 | 85 | /** 86 | * @param array $input 87 | * @return array 88 | */ 89 | public function transfer(array $input): array; 90 | 91 | /** 92 | * @param array $input 93 | * @return array 94 | */ 95 | public function register(array $input): array; 96 | 97 | /** 98 | * @param array $input 99 | * @return array 100 | */ 101 | public function autoRenew(array $input): array; 102 | 103 | /** 104 | * @param array $input 105 | * @return array 106 | */ 107 | public function listDnsTemplates(array $input): array; 108 | 109 | /** 110 | * @param array $input 111 | * @return array 112 | */ 113 | public function getDnsZone(array $input): array; 114 | 115 | /** 116 | * @param array $input 117 | * @return array 118 | */ 119 | public function editDnsZone(array $input): array; 120 | } 121 | -------------------------------------------------------------------------------- /src/Interfaces/FormParameterInterface.php: -------------------------------------------------------------------------------- 1 | $value 9 | * @return FormParameterInterface 10 | */ 11 | public static function fromArray(array $value = []): FormParameterInterface; 12 | 13 | /** 14 | * @return array 15 | */ 16 | public function toArray(): array; 17 | } 18 | -------------------------------------------------------------------------------- /src/Interfaces/GroupInterface.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function show(array $input): array; 12 | 13 | /** 14 | * @param array $input 15 | * @return array 16 | */ 17 | public function list(array $input = []): array; 18 | 19 | /** 20 | * @param array $input 21 | * @return array 22 | */ 23 | public function add(array $input): array; 24 | 25 | /** 26 | * @param array $input 27 | * @return array 28 | */ 29 | public function edit(array $input): array; 30 | 31 | /** 32 | * @param array $input 33 | * @return array 34 | */ 35 | public function delete(array $input): array; 36 | } 37 | -------------------------------------------------------------------------------- /src/Interfaces/HandleInterface.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function show(array $input): array; 12 | 13 | /** 14 | * @param array $input 15 | * @return array 16 | */ 17 | public function list(array $input = []): array; 18 | 19 | /** 20 | * @param array $input 21 | * @return array 22 | */ 23 | public function add(array $input): array; 24 | 25 | /** 26 | * @param array $input 27 | * @return array 28 | */ 29 | public function edit(array $input): array; 30 | 31 | /** 32 | * @param array $input 33 | * @return array 34 | */ 35 | public function delete(array $input): array; 36 | 37 | /** 38 | * @param array $input 39 | * @return array 40 | */ 41 | public function listDomain(array $input): array; 42 | } 43 | -------------------------------------------------------------------------------- /src/Interfaces/HostingInterface.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function show(array $input): array; 12 | 13 | /** 14 | * @param array $input 15 | * @return array 16 | */ 17 | public function list(array $input = []): array; 18 | 19 | /** 20 | * @param array $input 21 | * @return array 22 | */ 23 | public function add(array $input): array; 24 | 25 | /** 26 | * @param array $input 27 | * @return array 28 | */ 29 | public function edit(array $input): array; 30 | 31 | /** 32 | * @param array $input 33 | * @return array 34 | */ 35 | public function terminate(array $input): array; 36 | 37 | /** 38 | * @param array $input 39 | * @return array 40 | */ 41 | public function delete(array $input): array; 42 | 43 | /** 44 | * @param array $input 45 | * @return array 46 | */ 47 | public function suspend(array $input): array; 48 | 49 | /** 50 | * @param array $input 51 | * @return array 52 | */ 53 | public function unsuspend(array $input): array; 54 | 55 | /** 56 | * @param array $input 57 | * @return array 58 | */ 59 | public function create(array $input): array; 60 | 61 | /** 62 | * @param array $input 63 | * @return array 64 | */ 65 | public function removeFromServer(array $input): array; 66 | 67 | /** 68 | * @param array $input 69 | * @return array 70 | */ 71 | public function getDomainList(array $input): array; 72 | 73 | /** 74 | * @param array $input 75 | * @return array 76 | */ 77 | public function emailAccountData(array $input): array; 78 | 79 | /** 80 | * @param array $input 81 | * @return array 82 | */ 83 | public function upDowngrade(array $input): array; 84 | } 85 | -------------------------------------------------------------------------------- /src/Interfaces/HttpClientInterface.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function show(array $input): array; 12 | 13 | /** 14 | * @param array $input 15 | * @return array 16 | */ 17 | public function list(array $input = []): array; 18 | 19 | /** 20 | * @param array $input 21 | * @return array 22 | */ 23 | public function add(array $input): array; 24 | 25 | /** 26 | * @param array $input 27 | * @return array 28 | */ 29 | public function edit(array $input): array; 30 | 31 | /** 32 | * @param array $input 33 | * @return array 34 | */ 35 | public function delete(array $input): array; 36 | 37 | /** 38 | * @param array $input 39 | * @return array 40 | */ 41 | public function credit(array $input): array; 42 | 43 | /** 44 | * @param array $input 45 | * @return array 46 | */ 47 | public function partialPayment(array $input): array; 48 | 49 | /** 50 | * @param array $input 51 | * @return array 52 | */ 53 | public function markAsPaid(array $input): array; 54 | 55 | /** 56 | * @param array $input 57 | * @return array 58 | */ 59 | public function markAsUnpaid(array $input): array; 60 | 61 | /** 62 | * @param array $input 63 | * @return array 64 | */ 65 | public function sendByEmail(array $input): array; 66 | 67 | /** 68 | * @param array $input 69 | * @return array 70 | */ 71 | public function sendReminderByEmail(array $input): array; 72 | 73 | /** 74 | * @param array $input 75 | * @return array 76 | */ 77 | public function sendSummationByEmail(array $input): array; 78 | 79 | /** 80 | * @param array $input 81 | * @return array 82 | */ 83 | public function download(array $input): array; 84 | 85 | /** 86 | * @param array $input 87 | * @return array 88 | */ 89 | public function lineAdd(array $input): array; 90 | 91 | /** 92 | * @param array $input 93 | * @return array 94 | */ 95 | public function lineDelete(array $input): array; 96 | 97 | /** 98 | * @param array $input 99 | * @return array 100 | */ 101 | public function attachmentAdd(array $input): array; 102 | 103 | /** 104 | * @param array $input 105 | * @return array 106 | */ 107 | public function attachmentDelete(array $input): array; 108 | 109 | /** 110 | * @param array $input 111 | * @return array 112 | */ 113 | public function attachmentDownload(array $input): array; 114 | 115 | /** 116 | * @param array $input 117 | * @return array 118 | */ 119 | public function block(array $input): array; 120 | 121 | /** 122 | * @param array $input 123 | * @return array 124 | */ 125 | public function unblock(array $input): array; 126 | 127 | /** 128 | * @param array $input 129 | * @return array 130 | */ 131 | public function schedule(array $input): array; 132 | 133 | /** 134 | * @param array $input 135 | * @return array 136 | */ 137 | public function cancelSchedule(array $input): array; 138 | 139 | /** 140 | * @param array $input 141 | * @return array 142 | */ 143 | public function paymentProcessPause(array $input): array; 144 | 145 | /** 146 | * @param array $input 147 | * @return array 148 | */ 149 | public function paymentProcessReactivate(array $input): array; 150 | } 151 | -------------------------------------------------------------------------------- /src/Interfaces/OrderInterface.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function show(array $input): array; 12 | 13 | /** 14 | * @param array $input 15 | * @return array 16 | */ 17 | public function list(array $input = []): array; 18 | 19 | /** 20 | * @param array $input 21 | * @return array 22 | */ 23 | public function add(array $input): array; 24 | 25 | /** 26 | * @param array $input 27 | * @return array 28 | */ 29 | public function edit(array $input): array; 30 | 31 | /** 32 | * @param array $input 33 | * @return array 34 | */ 35 | public function process(array $input): array; 36 | 37 | /** 38 | * @param array $input 39 | * @return array 40 | */ 41 | public function lineAdd(array $input): array; 42 | 43 | /** 44 | * @param array $input 45 | * @return array 46 | */ 47 | public function lineDelete(array $input): array; 48 | } 49 | -------------------------------------------------------------------------------- /src/Interfaces/PriceQuoteInterface.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function show(array $input): array; 12 | 13 | /** 14 | * @param array $input 15 | * @return array 16 | */ 17 | public function list(array $input = []): array; 18 | 19 | /** 20 | * @param array $input 21 | * @return array 22 | */ 23 | public function add(array $input): array; 24 | 25 | /** 26 | * @param array $input 27 | * @return array 28 | */ 29 | public function edit(array $input): array; 30 | 31 | /** 32 | * @param array $input 33 | * @return array 34 | */ 35 | public function delete(array $input): array; 36 | 37 | /** 38 | * @param array $input 39 | * @return array 40 | */ 41 | public function sendByEmail(array $input): array; 42 | 43 | /** 44 | * @param array $input 45 | * @return array 46 | */ 47 | public function download(array $input): array; 48 | 49 | /** 50 | * @param array $input 51 | * @return array 52 | */ 53 | public function accept(array $input): array; 54 | 55 | /** 56 | * @param array $input 57 | * @return array 58 | */ 59 | public function decline(array $input): array; 60 | 61 | /** 62 | * @param array $input 63 | * @return array 64 | */ 65 | public function lineAdd(array $input): array; 66 | 67 | /** 68 | * @param array $input 69 | * @return array 70 | */ 71 | public function lineDelete(array $input): array; 72 | 73 | /** 74 | * @param array $input 75 | * @return array 76 | */ 77 | public function attachmentAdd(array $input): array; 78 | 79 | /** 80 | * @param array $input 81 | * @return array 82 | */ 83 | public function attachmentDelete(array $input): array; 84 | 85 | /** 86 | * @param array $input 87 | * @return array 88 | */ 89 | public function attachmentDownload(array $input): array; 90 | } 91 | -------------------------------------------------------------------------------- /src/Interfaces/ProductInterface.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function show(array $input): array; 12 | 13 | /** 14 | * @param array $input 15 | * @return array 16 | */ 17 | public function list(array $input = []): array; 18 | 19 | /** 20 | * @param array $input 21 | * @return array 22 | */ 23 | public function add(array $input): array; 24 | 25 | /** 26 | * @param array $input 27 | * @return array 28 | */ 29 | public function edit(array $input): array; 30 | 31 | /** 32 | * @param array $input 33 | * @return array 34 | */ 35 | public function delete(array $input): array; 36 | } 37 | -------------------------------------------------------------------------------- /src/Interfaces/ServiceInterface.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function show(array $input): array; 12 | 13 | /** 14 | * @param array $input 15 | * @return array 16 | */ 17 | public function list(array $input = []): array; 18 | 19 | /** 20 | * @param array $input 21 | * @return array 22 | */ 23 | public function add(array $input): array; 24 | 25 | /** 26 | * @param array $input 27 | * @return array 28 | */ 29 | public function edit(array $input): array; 30 | 31 | /** 32 | * @param array $input 33 | * @return array 34 | */ 35 | public function terminate(array $input): array; 36 | } 37 | -------------------------------------------------------------------------------- /src/Interfaces/SslInterface.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function show(array $input): array; 12 | 13 | /** 14 | * @param array $input 15 | * @return array 16 | */ 17 | public function list(array $input = []): array; 18 | 19 | /** 20 | * @param array $input 21 | * @return array 22 | */ 23 | public function add(array $input): array; 24 | 25 | /** 26 | * @param array $input 27 | * @return array 28 | */ 29 | public function edit(array $input): array; 30 | 31 | /** 32 | * @param array $input 33 | * @return array 34 | */ 35 | public function terminate(array $input): array; 36 | 37 | /** 38 | * @param array $input 39 | * @return array 40 | */ 41 | public function request(array $input): array; 42 | 43 | /** 44 | * @param array $input 45 | * @return array 46 | */ 47 | public function markAsInstalled(array $input): array; 48 | 49 | /** 50 | * @param array $input 51 | * @return array 52 | */ 53 | public function download(array $input): array; 54 | 55 | /** 56 | * @param array $input 57 | * @return array 58 | */ 59 | public function reissue(array $input): array; 60 | 61 | /** 62 | * @param array $input 63 | * @return array 64 | */ 65 | public function renew(array $input): array; 66 | 67 | /** 68 | * @param array $input 69 | * @return array 70 | */ 71 | public function getStatus(array $input): array; 72 | 73 | /** 74 | * @param array $input 75 | * @return array 76 | */ 77 | public function resendApproverEmail(array $input): array; 78 | 79 | /** 80 | * @param array $input 81 | * @return array 82 | */ 83 | public function revoke(array $input): array; 84 | 85 | /** 86 | * @param array $input 87 | * @return array 88 | */ 89 | public function markAsUninstalled(array $input): array; 90 | } 91 | -------------------------------------------------------------------------------- /src/Interfaces/TicketInterface.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function show(array $input): array; 12 | 13 | /** 14 | * @param array $input 15 | * @return array 16 | */ 17 | public function list(array $input = []): array; 18 | 19 | /** 20 | * @param array $input 21 | * @return array 22 | */ 23 | public function add(array $input): array; 24 | 25 | /** 26 | * @param array $input 27 | * @return array 28 | */ 29 | public function edit(array $input): array; 30 | 31 | /** 32 | * @param array $input 33 | * @return array 34 | */ 35 | public function delete(array $input): array; 36 | 37 | /** 38 | * @param array $input 39 | * @return array 40 | */ 41 | public function addMessage(array $input): array; 42 | 43 | /** 44 | * @param array $input 45 | * @return array 46 | */ 47 | public function changeStatus(array $input): array; 48 | 49 | /** 50 | * @param array $input 51 | * @return array 52 | */ 53 | public function changeOwner(array $input): array; 54 | 55 | /** 56 | * @param array $input 57 | * @return array 58 | */ 59 | public function attachmentDownload(array $input): array; 60 | } 61 | -------------------------------------------------------------------------------- /src/Interfaces/VpsInterface.php: -------------------------------------------------------------------------------- 1 | $input 9 | * @return array 10 | */ 11 | public function show(array $input): array; 12 | 13 | /** 14 | * @param array $input 15 | * @return array 16 | */ 17 | public function list(array $input = []): array; 18 | 19 | /** 20 | * @param array $input 21 | * @return array 22 | */ 23 | public function add(array $input): array; 24 | 25 | /** 26 | * @param array $input 27 | * @return array 28 | */ 29 | public function edit(array $input): array; 30 | 31 | /** 32 | * @param array $input 33 | * @return array 34 | */ 35 | public function terminate(array $input): array; 36 | 37 | /** 38 | * @param array $input 39 | * @return array 40 | */ 41 | public function create(array $input): array; 42 | 43 | /** 44 | * @param array $input 45 | * @return array 46 | */ 47 | public function start(array $input): array; 48 | 49 | /** 50 | * @param array $input 51 | * @return array 52 | */ 53 | public function pause(array $input): array; 54 | 55 | /** 56 | * @param array $input 57 | * @return array 58 | */ 59 | public function restart(array $input): array; 60 | 61 | /** 62 | * @param array $input 63 | * @return array 64 | */ 65 | public function suspend(array $input): array; 66 | 67 | /** 68 | * @param array $input 69 | * @return array 70 | */ 71 | public function unsuspend(array $input): array; 72 | 73 | /** 74 | * @param array $input 75 | * @return array 76 | */ 77 | public function downloadAccountData(array $input): array; 78 | 79 | /** 80 | * @param array $input 81 | * @return array 82 | */ 83 | public function emailAccountData(array $input): array; 84 | } 85 | -------------------------------------------------------------------------------- /src/Providers/HostfactServiceProvider.php: -------------------------------------------------------------------------------- 1 | publishes( 21 | [ 22 | self::$configPath . 'config.php' => config_path('Hostfact.php'), 23 | ], 24 | 'config' 25 | ); 26 | } 27 | 28 | /** 29 | * Register the application services. 30 | * 31 | * @return void 32 | */ 33 | public function register(): void 34 | { 35 | $this->mergeConfigFrom(self::$configPath . 'Hostfact.php', 'Hostfact'); 36 | } 37 | 38 | /** 39 | * Get the services provided by the provider. 40 | * 41 | * @return array 42 | */ 43 | public function provides(): array 44 | { 45 | return []; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Types/FormParameter.php: -------------------------------------------------------------------------------- 1 | 11 | */ 12 | private array $value; 13 | 14 | /** 15 | * @param array $value 16 | */ 17 | protected function __construct(array $value = []) 18 | { 19 | $this->value = $value; 20 | } 21 | 22 | /** 23 | * @param array $value 24 | * @return self 25 | */ 26 | public static function fromArray(array $value = []): self 27 | { 28 | return new self($value); 29 | } 30 | 31 | /** 32 | * @return array 33 | */ 34 | public function toArray(): array 35 | { 36 | return $this->value; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Types/Url.php: -------------------------------------------------------------------------------- 1 | instance = HttpClient::new( 20 | Url::fromString('test://hostfact.tld/Pro/apiv2/api.php') 21 | ); 22 | } 23 | 24 | /** 25 | * @throws GuzzleException 26 | */ 27 | public function testDoFakeRequest(): void 28 | { 29 | $this->expectException(RequestException::class); 30 | $this->instance->getHttpClient()->request('GET', '', []); 31 | } 32 | 33 | public function testInvalidUrl(): void 34 | { 35 | $this->expectException(InvalidArgumentException::class); 36 | Url::fromString('!?Invalid'); 37 | } 38 | 39 | public function testHttpClient(): void 40 | { 41 | self::assertIsObject( 42 | $this->instance->getHttpClient() 43 | ); 44 | } 45 | 46 | public function testCanGetStack(): void 47 | { 48 | self::assertIsObject( 49 | $this->instance->getStack() 50 | ); 51 | } 52 | } 53 | --------------------------------------------------------------------------------