Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change recordGet to be able to get all records #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions docs/Api/VdomainsApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -522,13 +522,36 @@ try {
?>
```

### Example #2
This example shows how to get a list of all records
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');

$api_instance = new GoDaddyDomainsClient\Api\VdomainsApi();
$domain = "domain_example"; // string | Domain whose DNS Records are to be retrieved
$type = NULL; // string | DNS Record Type for which DNS Records are to be retrieved
$name = NULL; // string | DNS Record Name for which DNS Records are to be retrieved
$x_shopper_id = "x_shopper_id_example"; // string | Shopper ID which owns the domain. NOTE: This is only required if you are a Reseller managing a domain purchased outside the scope of your reseller account. For instance, if you're a Reseller, but purchased a Domain via http://www.godaddy.com
$offset = 56; // int | Number of results to skip for pagination
$limit = 56; // int | Maximum number of items to return

try {
$result = $api_instance->recordGet($domain, $type, $name, $x_shopper_id, $offset, $limit);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling VdomainsApi->recordGet: ', $e->getMessage(), PHP_EOL;
}
?>
```

### Parameters

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**domain** | **string**| Domain whose DNS Records are to be retrieved |
**type** | **string**| DNS Record Type for which DNS Records are to be retrieved |
**name** | **string**| DNS Record Name for which DNS Records are to be retrieved |
**type** | **string**| DNS Record Type for which DNS Records are to be retrieved (Required only if Name is set)|
**name** | **string**| DNS Record Name for which DNS Records are to be retrieved (Optional, If used Type is required) |
**x_shopper_id** | **string**| Shopper ID which owns the domain. NOTE: This is only required if you are a Reseller managing a domain purchased outside the scope of your reseller account. For instance, if you&#39;re a Reseller, but purchased a Domain via http://www.godaddy.com | [optional]
**offset** | **int**| Number of results to skip for pagination | [optional]
**limit** | **int**| Maximum number of items to return | [optional]
Expand Down
27 changes: 12 additions & 15 deletions lib/Api/VdomainsApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -1218,9 +1218,9 @@ public function purchasePrivacyWithHttpInfo($domain, $body, $x_shopper_id = null
* Add the specified DNS Records to the specified Domain
*
* @param string $domain Domain whose DNS Records are to be augmented (required)
* @param \GoDaddyDomainsClient\Model\DNSRecord $records DNS Records to add to whatever currently exists (required)
* @param \GoDaddyDomainsClient\Model\DNSRecord[] $records DNS Records to add to whatever currently exists (required)
* @param string $x_shopper_id Shopper ID which owns the domain. NOTE: This is only required if you are a Reseller managing a domain purchased outside the scope of your reseller account. For instance, if you&#39;re a Reseller, but purchased a Domain via http://www.godaddy.com (optional)
* @return void
* @return Array of null, HTTP status code, HTTP response headers (array of strings)
* @throws \GoDaddyDomainsClient\ApiException on non-2xx response
*/
public function recordAdd($domain, $records, $x_shopper_id = null)
Expand All @@ -1235,7 +1235,7 @@ public function recordAdd($domain, $records, $x_shopper_id = null)
* Add the specified DNS Records to the specified Domain
*
* @param string $domain Domain whose DNS Records are to be augmented (required)
* @param \GoDaddyDomainsClient\Model\DNSRecord $records DNS Records to add to whatever currently exists (required)
* @param \GoDaddyDomainsClient\Model\DNSRecord[] $records DNS Records to add to whatever currently exists (required)
* @param string $x_shopper_id Shopper ID which owns the domain. NOTE: This is only required if you are a Reseller managing a domain purchased outside the scope of your reseller account. For instance, if you&#39;re a Reseller, but purchased a Domain via http://www.godaddy.com (optional)
* @return Array of null, HTTP status code, HTTP response headers (array of strings)
* @throws \GoDaddyDomainsClient\ApiException on non-2xx response
Expand Down Expand Up @@ -1348,15 +1348,15 @@ public function recordAddWithHttpInfo($domain, $records, $x_shopper_id = null)
* Retrieve DNS Records for the specified Domain, optionally with the specified Type and/or Name
*
* @param string $domain Domain whose DNS Records are to be retrieved (required)
* @param string $type DNS Record Type for which DNS Records are to be retrieved (required)
* @param string $type DNS Record Type for which DNS Records are to be retrieved (required only if name is used)
* @param string $name DNS Record Name for which DNS Records are to be retrieved (required)
* @param string $x_shopper_id Shopper ID which owns the domain. NOTE: This is only required if you are a Reseller managing a domain purchased outside the scope of your reseller account. For instance, if you&#39;re a Reseller, but purchased a Domain via http://www.godaddy.com (optional)
* @param int $offset Number of results to skip for pagination (optional)
* @param int $limit Maximum number of items to return (optional)
* @return \GoDaddyDomainsClient\Model\DNSRecord[]
* @throws \GoDaddyDomainsClient\ApiException on non-2xx response
*/
public function recordGet($domain, $type, $name, $x_shopper_id = null, $offset = null, $limit = null)
public function recordGet($domain, $type = null, $name = null, $x_shopper_id = null, $offset = null, $limit = null)
{
list($response) = $this->recordGetWithHttpInfo($domain, $type, $name, $x_shopper_id, $offset, $limit);
return $response;
Expand All @@ -1368,28 +1368,24 @@ public function recordGet($domain, $type, $name, $x_shopper_id = null, $offset =
* Retrieve DNS Records for the specified Domain, optionally with the specified Type and/or Name
*
* @param string $domain Domain whose DNS Records are to be retrieved (required)
* @param string $type DNS Record Type for which DNS Records are to be retrieved (required)
* @param string $type DNS Record Type for which DNS Records are to be retrieved (required only if name is used)
* @param string $name DNS Record Name for which DNS Records are to be retrieved (required)
* @param string $x_shopper_id Shopper ID which owns the domain. NOTE: This is only required if you are a Reseller managing a domain purchased outside the scope of your reseller account. For instance, if you&#39;re a Reseller, but purchased a Domain via http://www.godaddy.com (optional)
* @param int $offset Number of results to skip for pagination (optional)
* @param int $limit Maximum number of items to return (optional)
* @return Array of \GoDaddyDomainsClient\Model\DNSRecord[], HTTP status code, HTTP response headers (array of strings)
* @throws \GoDaddyDomainsClient\ApiException on non-2xx response
*/
public function recordGetWithHttpInfo($domain, $type, $name, $x_shopper_id = null, $offset = null, $limit = null)
public function recordGetWithHttpInfo($domain, $type = null, $name = null, $x_shopper_id = null, $offset = null, $limit = null)
{
// verify the required parameter 'domain' is set
if ($domain === null) {
throw new \InvalidArgumentException('Missing the required parameter $domain when calling recordGet');
}
// verify the required parameter 'type' is set
if ($type === null) {
if ($type === null && $name !== null) {
throw new \InvalidArgumentException('Missing the required parameter $type when calling recordGet');
}
// verify the required parameter 'name' is set
if ($name === null) {
throw new \InvalidArgumentException('Missing the required parameter $name when calling recordGet');
}
// parse inputs
$resourcePath = "/v1/domains/{domain}/records/{type?}/{name?}";
$httpBody = '';
Expand Down Expand Up @@ -1431,13 +1427,14 @@ public function recordGetWithHttpInfo($domain, $type, $name, $x_shopper_id = nul
);
}
// path params
if ($name !== null) {
if ($type !== null && $name !== null) {
$resourcePath = str_replace(
"{" . "name?" . "}",
$this->apiClient->getSerializer()->toPathValue($name),
$resourcePath
);
}
$resourcePath = str_replace(["{type?}", "{name?}"], "", $resourcePath);
// default format to json
$resourcePath = str_replace("{format}", "json", $resourcePath);

Expand Down Expand Up @@ -1513,7 +1510,7 @@ public function recordGetWithHttpInfo($domain, $type, $name, $x_shopper_id = nul
* @param string $domain Domain whose DNS Records are to be replaced (required)
* @param \GoDaddyDomainsClient\Model\DNSRecord[] $records DNS Records to replace whatever currently exists (required)
* @param string $x_shopper_id Shopper ID which owns the domain. NOTE: This is only required if you are a Reseller managing a domain purchased outside the scope of your reseller account. For instance, if you&#39;re a Reseller, but purchased a Domain via http://www.godaddy.com (optional)
* @return void
* @return Array of null, HTTP status code, HTTP response headers (array of strings)
* @throws \GoDaddyDomainsClient\ApiException on non-2xx response
*/
public function recordReplace($domain, $records, $x_shopper_id = null)
Expand Down Expand Up @@ -1644,7 +1641,7 @@ public function recordReplaceWithHttpInfo($domain, $records, $x_shopper_id = nul
* @param string $type DNS Record Type for which DNS Records are to be replaced (required)
* @param \GoDaddyDomainsClient\Model\DNSRecordCreateType[] $records DNS Records to replace whatever currently exists (required)
* @param string $x_shopper_id Shopper ID which owns the domain. NOTE: This is only required if you are a Reseller managing a domain purchased outside the scope of your reseller account. For instance, if you&#39;re a Reseller, but purchased a Domain via http://www.godaddy.com (optional)
* @return void
* @return Array of null, HTTP status code, HTTP response headers (array of strings)
* @throws \GoDaddyDomainsClient\ApiException on non-2xx response
*/
public function recordReplaceType($domain, $type, $records, $x_shopper_id = null)
Expand Down
3 changes: 3 additions & 0 deletions lib/Model/DNSRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,9 @@ public function getTtl()
*/
public function setTtl($ttl)
{
if ($ttl < 600) {
throw new \InvalidArgumentException('invalid value for $tty when calling DNSRecord, must be greater then or equal to 600.');
}
$this->container['ttl'] = $ttl;

return $this;
Expand Down