Skip to content
Merged
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
11 changes: 5 additions & 6 deletions .fern/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@
"homepage": "https://github.com/namedotcom/core-api-php"
}
},
"originGitCommit": "c3ab257628a7366dab6a8ad857854de9416d2338",
"originGitCommitIsDirty": true,
"invokedBy": "manual",
"requestedVersion": "1.29.0",
"ciProvider": null,
"sdkVersion": "1.29.0"
"originGitCommitIsDirty": null,
"invokedBy": "ci",
"requestedVersion": "1.31.0",
"ciProvider": "gitlab",
"sdkVersion": "1.31.0"
}
16 changes: 16 additions & 0 deletions .fern/replay.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .fernignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# Specify files that shouldn't be modified by Fern
.fern/replay.lock
.fern/replay.yml
.gitattributes
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.fern/replay.lock linguist-generated=true
44 changes: 12 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The Namecom PHP library provides convenient access to the Namecom APIs from PHP.

## Table of Contents

- [Documentation](#documentation)
- [Requirements](#requirements)
- [Installation](#installation)
- [Usage](#usage)
Expand All @@ -18,6 +19,10 @@ The Namecom PHP library provides convenient access to the Namecom APIs from PHP.
- [Timeouts](#timeouts)
- [Contributing](#contributing)

## Documentation

API reference documentation is available [here](https://docs.name.com).

## Requirements

This SDK requires PHP ^8.1.
Expand All @@ -38,38 +43,12 @@ Instantiate and use the client with the following:
namespace Example;

use Namecom\NamecomClient;
use Namecom\Accounts\Requests\CreateAccountRequest;
use Namecom\Types\AccountRequest;
use Namecom\Types\ContactsRequest;
use Namecom\Types\RegistrantContactRequest;

$client = new NamecomClient(
username: '<username>',
password: '<password>',
);
$client->accounts->createAccount(
new CreateAccountRequest([
'account' => new AccountRequest([
'contacts' => new ContactsRequest([
'registrant' => new RegistrantContactRequest([
'firstName' => 'Jane',
'lastName' => 'Doe',
'address1' => '123 Main St.',
'city' => 'Denver',
'state' => 'CO',
'zip' => '12345',
'country' => 'US',
'email' => 'admin@example.net',
'phone' => '+13035551212',
]),
]),
'accountName' => 'reseller_subaccount',
'password' => 'SecureP4ss!',
]),
'apiTos' => true,
'tos' => true,
]),
);
$client->hello();

```

Expand All @@ -78,7 +57,7 @@ $client->accounts->createAccount(
This SDK allows you to configure different environments for API requests.

```php
The SDK defaults to the `Default_` environment. To use a different environment, pass it to the client constructor:
The SDK defaults to the `Sandbox` environment. To use a different environment, pass it to the client constructor:

```php
use Namecom\NamecomClient;
Expand All @@ -93,7 +72,8 @@ $client = new NamecomClient(
```

Available environments:
- `Environments::Default_`
- `Environments::Sandbox`
- `Environments::Production`
```

## Exception Handling
Expand All @@ -105,7 +85,7 @@ use Namecom\Exceptions\NamecomApiException;
use Namecom\Exceptions\NamecomException;

try {
$response = $client->accounts->createAccount(...);
$response = $client->hello(...);
} catch (NamecomApiException $e) {
echo 'API Exception occurred: ' . $e->getMessage() . "\n";
echo 'Status Code: ' . $e->getCode() . "\n";
Expand Down Expand Up @@ -164,7 +144,7 @@ The `retryStatusCodes` configuration controls which [5XX](https://developer.mozi
Use the `maxRetries` request option to configure this behavior.

```php
$response = $client->accounts->createAccount(
$response = $client->hello(
...,
options: [
'maxRetries' => 0 // Override maxRetries at the request level
Expand All @@ -177,7 +157,7 @@ $response = $client->accounts->createAccount(
The SDK defaults to a 30 second timeout. Use the `timeout` option to configure this behavior.

```php
$response = $client->accounts->createAccount(
$response = $client->hello(
...,
options: [
'timeout' => 3.0 // Override timeout at the request level
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "namecom/core-api",
"version": "1.29.0",
"version": "1.31.0",
"description": "Official PHP SDK for the name.com Core API",
"keywords": [
"namecom",
Expand Down
47 changes: 24 additions & 23 deletions reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -1752,7 +1752,12 @@ Adds (registers) a new DNSSEC DS record for a domain.
```php
$client->dnsseCs->createDnssec(
'domainName',
new CreateDnssecBody([]),
new CreateDnssecBody([
'algorithm' => 1,
'digest' => 'digest',
'digestType' => 1,
'keyTag' => 1,
]),
);
```
</dd>
Expand All @@ -1776,39 +1781,31 @@ $client->dnsseCs->createDnssec(
<dl>
<dd>

**$algorithm:** `?int`

</dd>
</dl>

<dl>
<dd>

**$digest:** `?string` — Digest is a digest of the DNSKEY RR that is registered with the registry.
**$algorithm:** `int`

</dd>
</dl>

<dl>
<dd>

**$createDnssecBodyDomainName:** `?string` — The name of the domain.
**$digest:** `string` — Digest is a digest of the DNSKEY RR that is registered with the registry.

</dd>
</dl>

<dl>
<dd>

**$digestType:** `?int`
**$digestType:** `int`

</dd>
</dl>

<dl>
<dd>

**$keyTag:** `?int`
**$keyTag:** `int`

</dd>
</dl>
Expand Down Expand Up @@ -2866,10 +2863,10 @@ Sets up a new URL forwarding (redirect) for a domain or subdomain. If this is th
$client->urlForwardings->createUrlForwarding(
'example.com',
new CreateUrlForwardingRequest([
'body' => new UrlForwarding([
'body' => new UrlForwardingInput([
'forwardsTo' => 'https://destination-site.com',
'host' => 'www',
'type' => UrlForwardingType::Masked->value,
'type' => UrlForwardingInputType::Masked->value,
]),
]),
);
Expand All @@ -2895,7 +2892,7 @@ $client->urlForwardings->createUrlForwarding(
<dl>
<dd>

**$request:** `UrlForwarding`
**$request:** `UrlForwardingInput`

</dd>
</dl>
Expand Down Expand Up @@ -3003,9 +3000,10 @@ $client->urlForwardings->updateUrlForwarding(
'example.com',
'www.example.org',
new UpdateUrlForwardingRequest([
'body' => new UpdateUrlForwardingBody([
'body' => new UrlForwardingInput([
'forwardsTo' => 'https://destination-site.com',
'type' => UrlForwardingType::Masked->value,
'host' => 'www',
'type' => UrlForwardingInputType::Masked->value,
]),
]),
);
Expand Down Expand Up @@ -3039,7 +3037,7 @@ $client->urlForwardings->updateUrlForwarding(
<dl>
<dd>

**$request:** `UpdateUrlForwardingBody`
**$request:** `UrlForwardingInput`

</dd>
</dl>
Expand Down Expand Up @@ -3353,9 +3351,10 @@ $client->urlForwardings->updateUrlForwardingById(
'example.com',
12345,
new UpdateUrlForwardingByIdRequest([
'body' => new UpdateUrlForwardingBody([
'body' => new UrlForwardingInput([
'forwardsTo' => 'https://destination-site.com',
'type' => UrlForwardingType::Masked->value,
'host' => 'www',
'type' => UrlForwardingInputType::Masked->value,
]),
]),
);
Expand Down Expand Up @@ -3389,7 +3388,7 @@ $client->urlForwardings->updateUrlForwardingById(
<dl>
<dd>

**$request:** `UpdateUrlForwardingBody`
**$request:** `UrlForwardingInput`

</dd>
</dl>
Expand Down Expand Up @@ -3819,9 +3818,11 @@ Supported webhook event names:
- `domain.lock.status_change` – domain lock added or removed.
- `domain.transfer.status_change` – domain transfer IN to name.com; status updates while name.com is the gaining registrar.
- `domain.transfer_out.status_change` – domain transfer OUT from name.com to another registrar; fires when the domain is removed from the account.
- `domain.transfer.internal_in` - name.com domain transfers in to the subscribing account.
- `domain.transfer.internal_in` - name.com domain transfers in to the subscribing account via internal transfer.
- `domain.transfer.internal_out` - name.com domain transfers out of the subscribing account via internal transfer.
- `contact.verification.status_change` - contact verification status changes (verified or unverified).
- `domain.registry.rejection` – domain **create** failed after asynchronous registry processing (uncommon; most creates succeed at request time).
- `domain.expiration` – domain has expired and entered the post-expiry grace period. This is informational only.
</dd>
</dl>
</dd>
Expand Down
2 changes: 1 addition & 1 deletion src/AccountInfo/AccountInfoClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function checkAccountBalance(?array $options = null): ?CheckAccountBalanc
try {
$response = $this->client->sendRequest(
new JsonApiRequest(
baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? Environments::Default_->value,
baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? Environments::Sandbox->value,
path: "core/v1/accountinfo/balance",
method: HttpMethod::GET,
),
Expand Down
2 changes: 1 addition & 1 deletion src/Accounts/AccountsClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function createAccount(CreateAccountRequest $request, ?array $options = n
try {
$response = $this->client->sendRequest(
new JsonApiRequest(
baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? Environments::Default_->value,
baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? Environments::Sandbox->value,
path: "core/v1/accounts",
method: HttpMethod::POST,
body: $request,
Expand Down
6 changes: 3 additions & 3 deletions src/ContactVerification/ContactVerificationClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function unverifiedContactsList(UnverifiedContactsListRequest $request =
try {
$response = $this->client->sendRequest(
new JsonApiRequest(
baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? Environments::Default_->value,
baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? Environments::Sandbox->value,
path: "core/v1/contacts/unverified",
method: HttpMethod::GET,
query: $query,
Expand Down Expand Up @@ -137,7 +137,7 @@ public function verifyContact(int $verificationId, VerifyContactRequest $request
try {
$response = $this->client->sendRequest(
new JsonApiRequest(
baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? Environments::Default_->value,
baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? Environments::Sandbox->value,
path: "core/v1/contacts/verify/{$verificationId}",
method: HttpMethod::POST,
headers: $headers,
Expand Down Expand Up @@ -194,7 +194,7 @@ public function resendContactVerificationEmail(int $verificationId, ResendContac
try {
$response = $this->client->sendRequest(
new JsonApiRequest(
baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? Environments::Default_->value,
baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? Environments::Sandbox->value,
path: "core/v1/contacts/verify/{$verificationId}:resend",
method: HttpMethod::POST,
headers: $headers,
Expand Down
10 changes: 5 additions & 5 deletions src/Dns/DnsClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function listRecords(string $domainName, ListRecordsRequest $request = ne
try {
$response = $this->client->sendRequest(
new JsonApiRequest(
baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? Environments::Default_->value,
baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? Environments::Sandbox->value,
path: "core/v1/domains/{$domainName}/records",
method: HttpMethod::GET,
query: $query,
Expand Down Expand Up @@ -133,7 +133,7 @@ public function createRecord(string $domainName, DnsCreateRecordBody $request, ?
try {
$response = $this->client->sendRequest(
new JsonApiRequest(
baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? Environments::Default_->value,
baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? Environments::Sandbox->value,
path: "core/v1/domains/{$domainName}/records",
method: HttpMethod::POST,
body: $request,
Expand Down Expand Up @@ -183,7 +183,7 @@ public function getRecord(string $domainName, int $id, ?array $options = null):
try {
$response = $this->client->sendRequest(
new JsonApiRequest(
baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? Environments::Default_->value,
baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? Environments::Sandbox->value,
path: "core/v1/domains/{$domainName}/records/{$id}",
method: HttpMethod::GET,
),
Expand Down Expand Up @@ -233,7 +233,7 @@ public function updateRecord(string $domainName, int $id, DnsUpdateRecordBody $r
try {
$response = $this->client->sendRequest(
new JsonApiRequest(
baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? Environments::Default_->value,
baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? Environments::Sandbox->value,
path: "core/v1/domains/{$domainName}/records/{$id}",
method: HttpMethod::PUT,
body: $request,
Expand Down Expand Up @@ -282,7 +282,7 @@ public function deleteRecord(string $domainName, int $id, ?array $options = null
try {
$response = $this->client->sendRequest(
new JsonApiRequest(
baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? Environments::Default_->value,
baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? Environments::Sandbox->value,
path: "core/v1/domains/{$domainName}/records/{$id}",
method: HttpMethod::DELETE,
),
Expand Down
Loading
Loading