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
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@

### Removed

- Deprecated `GetDomainPremiumPrice`. Use `GetDomainPrices` instead.
- Removed deprecated `GetDomainPremiumPrice`. Use `GetDomainPrices` instead.
- Removed deprecated `GetDomainPremiumPrice`. Use `GetDomainPrices` instead.
- Removed deprecated `GetWhoisPrivacy` (dnsimple/dnsimple-developer#919)
- Removed deprecated `RenewWhoisPrivacy` (dnsimple/dnsimple-developer#919)

## 7.0.1 - 2025-10-22

Expand Down
50 changes: 0 additions & 50 deletions dnsimple/registrar_whois_privacy.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,46 +15,12 @@ type WhoisPrivacy struct {
UpdatedAt string `json:"updated_at,omitempty"`
}

// WhoisPrivacyRenewal represents a whois privacy renewal in DNSimple.
type WhoisPrivacyRenewal struct {
ID int64 `json:"id,omitempty"`
DomainID int64 `json:"domain_id,omitempty"`
WhoisPrivacyID int64 `json:"whois_privacy_id,omitempty"`
State string `json:"string,omitempty"`
Enabled bool `json:"enabled,omitempty"`
ExpiresOn string `json:"expires_on,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
UpdatedAt string `json:"updated_at,omitempty"`
}

// WhoisPrivacyResponse represents a response from an API method that returns a WhoisPrivacy struct.
type WhoisPrivacyResponse struct {
Response
Data *WhoisPrivacy `json:"data"`
}

// WhoisPrivacyRenewalResponse represents a response from an API method that returns a WhoisPrivacyRenewal struct.
type WhoisPrivacyRenewalResponse struct {
Response
Data *WhoisPrivacyRenewal `json:"data"`
}

// GetWhoisPrivacy gets the whois privacy for the domain.
//
// See https://developer.dnsimple.com/v2/registrar/whois-privacy/#get
func (s *RegistrarService) GetWhoisPrivacy(ctx context.Context, accountID string, domainName string) (*WhoisPrivacyResponse, error) {
path := versioned(fmt.Sprintf("/%v/registrar/domains/%v/whois_privacy", accountID, domainName))
privacyResponse := &WhoisPrivacyResponse{}

resp, err := s.client.get(ctx, path, privacyResponse)
if err != nil {
return nil, err
}

privacyResponse.HTTPResponse = resp
return privacyResponse, nil
}

// EnableWhoisPrivacy enables the whois privacy for the domain.
//
// See https://developer.dnsimple.com/v2/registrar/whois-privacy/#enable
Expand Down Expand Up @@ -86,19 +52,3 @@ func (s *RegistrarService) DisableWhoisPrivacy(ctx context.Context, accountID st
privacyResponse.HTTPResponse = resp
return privacyResponse, nil
}

// RenewWhoisPrivacy renews the whois privacy for the domain.
//
// See https://developer.dnsimple.com/v2/registrar/whois-privacy/#renew
func (s *RegistrarService) RenewWhoisPrivacy(ctx context.Context, accountID string, domainName string) (*WhoisPrivacyRenewalResponse, error) {
path := versioned(fmt.Sprintf("/%v/registrar/domains/%v/whois_privacy/renewals", accountID, domainName))
privacyRenewalResponse := &WhoisPrivacyRenewalResponse{}

resp, err := s.client.post(ctx, path, nil, privacyRenewalResponse)
if err != nil {
return nil, err
}

privacyRenewalResponse.HTTPResponse = resp
return privacyRenewalResponse, nil
}
50 changes: 0 additions & 50 deletions dnsimple/registrar_whois_privacy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,6 @@ import (
"github.com/stretchr/testify/assert"
)

func TestRegistrarService_GetWhoisPrivacy(t *testing.T) {
setupMockServer()
defer teardownMockServer()

mux.HandleFunc("/v2/1010/registrar/domains/example.com/whois_privacy", func(w http.ResponseWriter, r *http.Request) {
httpResponse := httpResponseFixture(t, "/api/getWhoisPrivacy/success.http")

testMethod(t, r, "GET")
testHeaders(t, r)

w.WriteHeader(httpResponse.StatusCode)
_, _ = io.Copy(w, httpResponse.Body)
})

privacyResponse, err := client.Registrar.GetWhoisPrivacy(context.Background(), "1010", "example.com")

assert.NoError(t, err)
privacy := privacyResponse.Data
wantSingle := &WhoisPrivacy{
ID: 1,
DomainID: 2,
Enabled: true,
ExpiresOn: "2017-02-13",
CreatedAt: "2016-02-13T14:34:50Z",
UpdatedAt: "2016-02-13T14:34:52Z",
}
assert.Equal(t, wantSingle, privacy)
}

func TestRegistrarService_EnableWhoisPrivacy(t *testing.T) {
setupMockServer()
defer teardownMockServer()
Expand Down Expand Up @@ -85,24 +56,3 @@ func TestRegistrarService_DisableWhoisPrivacy(t *testing.T) {
privacy := privacyResponse.Data
assert.Equal(t, int64(1), privacy.ID)
}

func TestRegistrarService_RenewWhoisPrivacy(t *testing.T) {
setupMockServer()
defer teardownMockServer()

mux.HandleFunc("/v2/1010/registrar/domains/example.com/whois_privacy/renewals", func(w http.ResponseWriter, r *http.Request) {
httpResponse := httpResponseFixture(t, "/api/renewWhoisPrivacy/success.http")

testMethod(t, r, "POST")
testHeaders(t, r)

w.WriteHeader(httpResponse.StatusCode)
_, _ = io.Copy(w, httpResponse.Body)
})

privacyRenewalResponse, err := client.Registrar.RenewWhoisPrivacy(context.Background(), "1010", "example.com")

assert.NoError(t, err)
privacyRenewal := privacyRenewalResponse.Data
assert.Equal(t, int64(1), privacyRenewal.ID)
}
16 changes: 0 additions & 16 deletions fixtures.http/api/getWhoisPrivacy/success.http

This file was deleted.

20 changes: 0 additions & 20 deletions fixtures.http/api/renewWhoisPrivacy/success.http

This file was deleted.

This file was deleted.

18 changes: 0 additions & 18 deletions fixtures.http/api/renewWhoisPrivacy/whois-privacy-not-found.http

This file was deleted.

Loading