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: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

This project uses [Semantic Versioning 2.0.0](http://semver.org/), the format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## Unreleased

### Added

- Added `initiatePushWithIdentifier` to initiate domain pushes using an account identifier.
- Added `getName` to `Account`.

### Deprecated

- Deprecated `initiatePush`. Use `initiatePushWithIdentifier` instead.

## 5.2.0 - 2026-03-23

### Added
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/com/dnsimple/data/Account.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
public class Account {
private final Long id;
private final String email;
private final String name;
private final String planIdentifier;
private final OffsetDateTime createdAt;
private final OffsetDateTime updatedAt;

public Account(Long id, String email, String planIdentifier, OffsetDateTime createdAt, OffsetDateTime updatedAt) {
public Account(Long id, String email, String name, String planIdentifier, OffsetDateTime createdAt, OffsetDateTime updatedAt) {
this.id = id;
this.email = email;
this.name = name;
this.planIdentifier = planIdentifier;
this.createdAt = createdAt;
this.updatedAt = updatedAt;
Expand All @@ -25,6 +27,10 @@ public String getEmail() {
return email;
}

public String getName() {
return name;
}

public String getPlanIdentifier() {
return planIdentifier;
}
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/com/dnsimple/endpoints/Domains.java
Original file line number Diff line number Diff line change
Expand Up @@ -265,15 +265,30 @@ public EmptyResponse deleteEmailForward(Number account, String domain, Number em
return client.empty(DELETE, account + "/domains/" + domain + "/email_forwards/" + emailForward, ListOptions.empty(), null);
}

/**
* Initiate a push using an account identifier.
*
* @param account The account ID
* @param domain The domain name or ID
* @param newAccountIdentifier The account identifier of the target account
* @return The initiate push response
* @see <a href="https://developer.dnsimple.com/v2/domains/pushes/#initiateDomainPush">https://developer.dnsimple.com/v2/domains/pushes/#initiateDomainPush</a>
*/
public SimpleResponse<DomainPush> initiatePushWithIdentifier(Number account, String domain, String newAccountIdentifier) {
return client.simple(POST, account + "/domains/" + domain + "/pushes", ListOptions.empty(), singletonMap("new_account_identifier", newAccountIdentifier), DomainPush.class);
}

/**
* Initiate a push.
*
* @param account The account ID
* @param domain The domain name or ID
* @param newAccountEmail The email address of the target DNSimple account
* @return The initiate push response
* @deprecated Use {@link #initiatePushWithIdentifier(Number, String, String)} instead
* @see <a href="https://developer.dnsimple.com/v2/domains/pushes/#initiateDomainPush">https://developer.dnsimple.com/v2/domains/pushes/#initiateDomainPush</a>
*/
@Deprecated
public SimpleResponse<DomainPush> initiatePush(Number account, String domain, String newAccountEmail) {
return client.simple(POST, account + "/domains/" + domain + "/pushes", ListOptions.empty(), singletonMap("new_account_email", newAccountEmail), DomainPush.class);
}
Expand Down
1 change: 1 addition & 0 deletions src/test/java/com/dnsimple/endpoints/AccountsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public void testListAccounts() {
assertThat(accounts, hasSize(1));
assertThat(accounts.get(0).getId(), is(123L));
assertThat(accounts.get(0).getEmail(), is("john@example.com"));
assertThat(accounts.get(0).getName(), is("John"));
assertThat(accounts.get(0).getPlanIdentifier(), is("dnsimple-personal"));
assertThat(accounts.get(0).getCreatedAt(), is(OffsetDateTime.of(2011, 9, 11, 17, 15, 58, 0, UTC)));
assertThat(accounts.get(0).getUpdatedAt(), is(OffsetDateTime.of(2016, 6, 3, 15, 2, 26, 0, UTC)));
Expand Down
8 changes: 8 additions & 0 deletions src/test/java/com/dnsimple/endpoints/DomainPushesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ public void testInitiatePushProducesPush() {
assertThat(domainPush.getAcceptedAt(), is(nullValue()));
}

@Test
public void testInitiatePushWithIdentifierProducesPush() {
server.stubFixtureAt("initiatePush/success.http");
DomainPush domainPush = client.domains.initiatePushWithIdentifier(1, "example.com", "abc123").getData();
assertThat(domainPush.getId(), is(1L));
assertThat(domainPush.getAccountId(), is(2020L));
}

@Test
public void testListPushesProducesPushList() {
server.stubFixtureAt("listPushes/success.http");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ x-permitted-cross-domain-policies: none
x-xss-protection: 1; mode=block
strict-transport-security: max-age=31536000

{"data":[{"id":123,"email":"john@example.com","plan_identifier":"dnsimple-personal","created_at":"2011-09-11T17:15:58Z","updated_at":"2016-06-03T15:02:26Z"}]}
{"data":[{"id":123,"email":"john@example.com","name":"John","plan_identifier":"dnsimple-personal","created_at":"2011-09-11T17:15:58Z","updated_at":"2016-06-03T15:02:26Z"}]}
2 changes: 1 addition & 1 deletion src/test/resources/com/dnsimple/accounts/success-user.http
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ x-permitted-cross-domain-policies: none
x-xss-protection: 1; mode=block
strict-transport-security: max-age=31536000

{"data":[{"id":123,"email":"john@example.com","plan_identifier":"dnsimple-personal","created_at":"2011-09-11T17:15:58Z","updated_at":"2016-06-03T15:02:26Z"},{"id":456,"email":"ops@company.com","plan_identifier":"teams-v1-monthly","created_at":"2012-03-16T16:02:54Z","updated_at":"2016-06-14T11:23:16Z"}]}
{"data":[{"id":123,"email":"john@example.com","name":"John","plan_identifier":"dnsimple-personal","created_at":"2011-09-11T17:15:58Z","updated_at":"2016-06-03T15:02:26Z"},{"id":456,"email":"ops@company.com","name":"Ops Company","plan_identifier":"teams-v1-monthly","created_at":"2012-03-16T16:02:54Z","updated_at":"2016-06-14T11:23:16Z"}]}

Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ x-permitted-cross-domain-policies: none
x-xss-protection: 1; mode=block
strict-transport-security: max-age=31536000

{"data":[{"id":123,"email":"john@example.com","plan_identifier":"dnsimple-personal","created_at":"2011-09-11T17:15:58Z","updated_at":"2016-06-03T15:02:26Z"}]}
{"data":[{"id":123,"email":"john@example.com","name":"John","plan_identifier":"dnsimple-personal","created_at":"2011-09-11T17:15:58Z","updated_at":"2016-06-03T15:02:26Z"}]}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ x-permitted-cross-domain-policies: none
x-xss-protection: 1; mode=block
strict-transport-security: max-age=31536000

{"data":[{"id":123,"email":"john@example.com","plan_identifier":"dnsimple-personal","created_at":"2011-09-11T17:15:58Z","updated_at":"2016-06-03T15:02:26Z"},{"id":456,"email":"ops@company.com","plan_identifier":"teams-v1-monthly","created_at":"2012-03-16T16:02:54Z","updated_at":"2016-06-14T11:23:16Z"}]}
{"data":[{"id":123,"email":"john@example.com","name":"John","plan_identifier":"dnsimple-personal","created_at":"2011-09-11T17:15:58Z","updated_at":"2016-06-03T15:02:26Z"},{"id":456,"email":"ops@company.com","name":"Ops Company","plan_identifier":"teams-v1-monthly","created_at":"2012-03-16T16:02:54Z","updated_at":"2016-06-14T11:23:16Z"}]}
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ x-request-id: 15a7f3a5-7ee5-4e36-ac5a-8c21c2e1fffd
x-runtime: 0.141588
strict-transport-security: max-age=31536000

{"data":{"user":null,"account":{"id":1,"email":"example-account@example.com","plan_identifier":"teams-v1-monthly","created_at":"2015-09-18T23:04:37Z","updated_at":"2016-06-09T20:03:39Z"}}}
{"data":{"user":null,"account":{"id":1,"email":"example-account@example.com","name":"Example Account","plan_identifier":"teams-v1-monthly","created_at":"2015-09-18T23:04:37Z","updated_at":"2016-06-09T20:03:39Z"}}}
2 changes: 1 addition & 1 deletion src/test/resources/com/dnsimple/whoami/success.http
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ x-request-id: 15a7f3a5-7ee5-4e36-ac5a-8c21c2e1fffd
x-runtime: 0.141588
strict-transport-security: max-age=31536000

{"data":{"user":null,"account":{"id":1,"email":"example-account@example.com","plan_identifier":"teams-v1-monthly","created_at":"2015-09-18T23:04:37Z","updated_at":"2016-06-09T20:03:39Z"}}}
{"data":{"user":null,"account":{"id":1,"email":"example-account@example.com","name":"Example Account","plan_identifier":"teams-v1-monthly","created_at":"2015-09-18T23:04:37Z","updated_at":"2016-06-09T20:03:39Z"}}}