|
| 1 | +# Hostinger\HostingGitApi |
| 2 | + |
| 3 | +All URIs are relative to https://developers.hostinger.com, except if the operation defines another base path. |
| 4 | + |
| 5 | +| Method | HTTP request | Description | |
| 6 | +| ------------- | ------------- | ------------- | |
| 7 | +| [**listGitInstallationRepositoriesV1()**](HostingGitApi.md#listGitInstallationRepositoriesV1) | **GET** /api/hosting/v1/git/installations/{uuid}/repositories | List Git installation repositories | |
| 8 | +| [**listGitInstallationsV1()**](HostingGitApi.md#listGitInstallationsV1) | **GET** /api/hosting/v1/git/installations | List Git installations | |
| 9 | + |
| 10 | + |
| 11 | +## `listGitInstallationRepositoriesV1()` |
| 12 | + |
| 13 | +```php |
| 14 | +listGitInstallationRepositoriesV1($uuid): \Hostinger\Model\HostingV1GitGitRepositoryResource[] |
| 15 | +``` |
| 16 | + |
| 17 | +List Git installation repositories |
| 18 | + |
| 19 | +Lists the repositories the Git installation can access, read live from the provider. Works for github and gitlab installations. Use an active installation: a suspended or pending one is still queried and the call fails with whatever the provider answers. The list is cut at the first 500 repositories in the order the provider returns them; when the account has more, name the repository directly instead of searching this list. `owner`, `name` and `default_branch` identify a repository and a branch to deploy. Returns 404 when the installation does not belong to the customer. Limited to 10 calls per minute per API client (429 above that). |
| 20 | + |
| 21 | +### Example |
| 22 | + |
| 23 | +```php |
| 24 | +<?php |
| 25 | +require_once(__DIR__ . '/vendor/autoload.php'); |
| 26 | + |
| 27 | + |
| 28 | +// Configure Bearer authorization: apiToken |
| 29 | +$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); |
| 30 | + |
| 31 | + |
| 32 | +$apiInstance = new Hostinger\Api\HostingGitApi(config: $config); |
| 33 | +$uuid = 018f5e2a-1234-7890-abcd-1234567890ab; // string | Git installation UUID from the List Git installations endpoint |
| 34 | + |
| 35 | +try { |
| 36 | + $result = $apiInstance->listGitInstallationRepositoriesV1($uuid); |
| 37 | + print_r($result); |
| 38 | +} catch (Exception $e) { |
| 39 | + echo 'Exception when calling HostingGitApi->listGitInstallationRepositoriesV1: ', $e->getMessage(), PHP_EOL; |
| 40 | +} |
| 41 | +``` |
| 42 | + |
| 43 | +### Parameters |
| 44 | + |
| 45 | +| Name | Type | Description | Notes | |
| 46 | +| ------------- | ------------- | ------------- | ------------- | |
| 47 | +| **uuid** | **string**| Git installation UUID from the List Git installations endpoint | | |
| 48 | + |
| 49 | +### Return type |
| 50 | + |
| 51 | +[**\Hostinger\Model\HostingV1GitGitRepositoryResource[]**](../Model/HostingV1GitGitRepositoryResource.md) |
| 52 | + |
| 53 | +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) |
| 54 | +[[Back to Model list]](../../README.md#models) |
| 55 | +[[Back to README]](../../README.md) |
| 56 | + |
| 57 | +## `listGitInstallationsV1()` |
| 58 | + |
| 59 | +```php |
| 60 | +listGitInstallationsV1($provider, $status): \Hostinger\Model\HostingV1GitGitInstallationResource[] |
| 61 | +``` |
| 62 | + |
| 63 | +List Git installations |
| 64 | + |
| 65 | +Lists the Git provider accounts the customer has connected. Only installations with status `active` are returned unless the `status` filter says otherwise. An empty list means the customer has no active installation. Check `status=suspended` and `status=pending` as well. If there is none at all, GitHub has to be connected once in hPanel (Websites, Manage, Advanced, Git, Connect GitHub; or Add Website, Node.js Web App, Import Git Repository, Continue with GitHub); this endpoint then lists the new installation. Use `uuid` as the path parameter of `List Git installation repositories`. |
| 66 | + |
| 67 | +### Example |
| 68 | + |
| 69 | +```php |
| 70 | +<?php |
| 71 | +require_once(__DIR__ . '/vendor/autoload.php'); |
| 72 | + |
| 73 | + |
| 74 | +// Configure Bearer authorization: apiToken |
| 75 | +$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); |
| 76 | + |
| 77 | + |
| 78 | +$apiInstance = new Hostinger\Api\HostingGitApi(config: $config); |
| 79 | +$provider = github; // string | Filter by Git provider |
| 80 | +$status = active; // string | Filter by installation status |
| 81 | + |
| 82 | +try { |
| 83 | + $result = $apiInstance->listGitInstallationsV1($provider, $status); |
| 84 | + print_r($result); |
| 85 | +} catch (Exception $e) { |
| 86 | + echo 'Exception when calling HostingGitApi->listGitInstallationsV1: ', $e->getMessage(), PHP_EOL; |
| 87 | +} |
| 88 | +``` |
| 89 | + |
| 90 | +### Parameters |
| 91 | + |
| 92 | +| Name | Type | Description | Notes | |
| 93 | +| ------------- | ------------- | ------------- | ------------- | |
| 94 | +| **provider** | **string**| Filter by Git provider | [optional] | |
| 95 | +| **status** | **string**| Filter by installation status | [optional] [default to 'active'] | |
| 96 | + |
| 97 | +### Return type |
| 98 | + |
| 99 | +[**\Hostinger\Model\HostingV1GitGitInstallationResource[]**](../Model/HostingV1GitGitInstallationResource.md) |
| 100 | + |
| 101 | +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) |
| 102 | +[[Back to Model list]](../../README.md#models) |
| 103 | +[[Back to README]](../../README.md) |
0 commit comments