diff --git a/.fern/metadata.json b/.fern/metadata.json index c464841..ecc6cf8 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -10,9 +10,8 @@ "clientName": "Namecom", "enableWireTests": true }, - "originGitCommit": "c3ab257628a7366dab6a8ad857854de9416d2338", - "originGitCommitIsDirty": true, - "invokedBy": "manual", - "requestedVersion": "1.29.0", - "sdkVersion": "v1.29.0" + "invokedBy": "ci", + "requestedVersion": "1.31.0", + "ciProvider": "gitlab", + "sdkVersion": "v1.31.0" } \ No newline at end of file diff --git a/.fern/replay.lock b/.fern/replay.lock new file mode 100644 index 0000000..896ba1f --- /dev/null +++ b/.fern/replay.lock @@ -0,0 +1,16 @@ +# DO NOT EDIT MANUALLY - Managed by Fern Replay +version: "1.0" +generations: + - commit_sha: 9b6e5ce9c43aed895536b86483986ee32d09b7e6 + tree_hash: 1ebf84c2bce4be3fbf519a4ead5b7d1f3606b0f9 + timestamp: 2026-07-21T20:06:34.283Z + cli_version: unknown + generator_versions: {} + - commit_sha: 64ab9341d1faa7e65db85835763bccb74057e74b + tree_hash: d4d7704bf44c8cb31457889e7a5721d14781ee46 + timestamp: 2026-07-21T20:06:34.668Z + cli_version: unknown + generator_versions: + fernapi/fern-go-sdk: 1.46.2 +current_generation: 64ab9341d1faa7e65db85835763bccb74057e74b +patches: [] diff --git a/.fernignore b/.fernignore index 084a8eb..b8eb8bf 100644 --- a/.fernignore +++ b/.fernignore @@ -1 +1,4 @@ # Specify files that shouldn't be modified by Fern +.fern/replay.lock +.fern/replay.yml +.gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..74928d6 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +.fern/replay.lock linguist-generated=true diff --git a/README.md b/README.md index 5da6424..c6bcbd4 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,12 @@ -# Namecom Go Library +# name.com Core API Go Library [![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Fnamedotcom%2Fcore-api-go) -The Namecom Go library provides convenient access to the Namecom APIs from Go. +The name.com Core API Go library provides convenient access to the name.com Core API APIs from Go. ## Table of Contents +- [Documentation](#documentation) - [Reference](#reference) - [Usage](#usage) - [Environments](#environments) @@ -18,6 +19,10 @@ The Namecom Go library provides convenient access to the Namecom APIs from Go. - [Explicit Null](#explicit-null) - [Contributing](#contributing) +## Documentation + +API reference documentation is available [here](https://docs.name.com). + ## Reference A full reference for this library is available [here](https://github.com/namedotcom/core-api-go/blob/HEAD/./reference.md). @@ -32,7 +37,6 @@ package example import ( context "context" - coreapigo "github.com/namedotcom/core-api-go" client "github.com/namedotcom/core-api-go/client" option "github.com/namedotcom/core-api-go/option" ) @@ -44,52 +48,8 @@ func do() { "", ), ) - request := &coreapigo.CreateAccountRequest{ - Account: &coreapigo.AccountRequest{ - Contacts: &coreapigo.ContactsRequest{ - Registrant: &coreapigo.RegistrantContactRequest{ - FirstName: coreapigo.String( - "Jane", - ), - LastName: coreapigo.String( - "Doe", - ), - Address1: coreapigo.String( - "123 Main St.", - ), - City: coreapigo.String( - "Denver", - ), - State: coreapigo.String( - "CO", - ), - Zip: coreapigo.String( - "12345", - ), - Country: coreapigo.String( - "US", - ), - Email: coreapigo.String( - "admin@example.net", - ), - Phone: coreapigo.String( - "+13035551212", - ), - }, - }, - AccountName: coreapigo.String( - "reseller_subaccount", - ), - Password: coreapigo.String( - "SecureP4ss!", - ), - }, - APITos: true, - Tos: true, - } - client.Accounts.CreateAccount( + client.Hello( context.TODO(), - request, ) } ``` @@ -101,7 +61,7 @@ URL, which is particularly useful in test environments. ```go client := client.NewClient( - option.WithBaseURL(api.Environments.Default), + option.WithBaseURL(api.Environments.Sandbox), ) ``` @@ -111,7 +71,7 @@ Structured error types are returned from API calls that return non-success statu with the `errors.Is` and `errors.As` APIs, so you can access the error like so: ```go -response, err := client.Accounts.CreateAccount(...) +response, err := client.Hello(...) if err != nil { var apiError *core.APIError if errors.As(err, apiError) { @@ -145,7 +105,7 @@ client := client.NewClient( ) // Specify options for an individual request. -response, err := client.Accounts.CreateAccount( +response, err := client.Hello( ..., option.WithToken(""), ) @@ -160,7 +120,7 @@ when you need to examine the response headers received from the API call. (When the raw HTTP response data will be included automatically in the Page response object.) ```go -response, err := client.Accounts.WithRawResponse.CreateAccount(...) +response, err := client.WithRawResponse.Hello(...) if err != nil { return err } @@ -198,7 +158,7 @@ client := client.NewClient( option.WithMaxAttempts(1), ) -response, err := client.Accounts.CreateAccount( +response, err := client.Hello( ..., option.WithMaxAttempts(1), ) @@ -212,7 +172,7 @@ Setting a timeout for each individual request is as simple as using the standard ctx, cancel := context.WithTimeout(ctx, time.Second) defer cancel() -response, err := client.Accounts.CreateAccount(ctx, ...) +response, err := client.Hello(ctx, ...) ``` ### Explicit Null @@ -234,7 +194,7 @@ type ExampleRequest struct { request := &ExampleRequest{} request.SetName(nil) -response, err := client.Accounts.CreateAccount(ctx, request, ...) +response, err := client.Hello(ctx, request, ...) ``` ## Contributing diff --git a/core/request_option.go b/core/request_option.go index 28cbd12..bc2f160 100644 --- a/core/request_option.go +++ b/core/request_option.go @@ -62,8 +62,8 @@ func (r *RequestOptions) cloneHeader() http.Header { headers := r.HTTPHeader.Clone() headers.Set("X-Fern-Language", "Go") headers.Set("X-Fern-SDK-Name", "github.com/namedotcom/core-api-go") - headers.Set("X-Fern-SDK-Version", "v1.29.0") - headers.Set("User-Agent", "github.com/namedotcom/core-api-go/1.29.0") + headers.Set("X-Fern-SDK-Version", "v1.31.0") + headers.Set("User-Agent", "github.com/namedotcom/core-api-go/1.31.0") return headers } diff --git a/dnsse_cs.go b/dnsse_cs.go index 55626ca..9fac7ab 100644 --- a/dnsse_cs.go +++ b/dnsse_cs.go @@ -10,24 +10,21 @@ import ( ) var ( - createDnssecBodyFieldDomainName = big.NewInt(1 << 0) - createDnssecBodyFieldAlgorithm = big.NewInt(1 << 1) - createDnssecBodyFieldDigest = big.NewInt(1 << 2) - createDnssecBodyFieldCreateDnssecBodyDomainName = big.NewInt(1 << 3) - createDnssecBodyFieldDigestType = big.NewInt(1 << 4) - createDnssecBodyFieldKeyTag = big.NewInt(1 << 5) + createDnssecBodyFieldDomainName = big.NewInt(1 << 0) + createDnssecBodyFieldAlgorithm = big.NewInt(1 << 1) + createDnssecBodyFieldDigest = big.NewInt(1 << 2) + createDnssecBodyFieldDigestType = big.NewInt(1 << 3) + createDnssecBodyFieldKeyTag = big.NewInt(1 << 4) ) type CreateDnssecBody struct { // DomainName is the domain name to create keys for. DomainName string `json:"-" url:"-"` - Algorithm *int `json:"algorithm,omitempty" url:"-"` + Algorithm int `json:"algorithm" url:"-"` // Digest is a digest of the DNSKEY RR that is registered with the registry. - Digest *string `json:"digest,omitempty" url:"-"` - // The name of the domain. - CreateDnssecBodyDomainName *string `json:"domainName,omitempty" url:"-"` - DigestType *int `json:"digestType,omitempty" url:"-"` - KeyTag *int `json:"keyTag,omitempty" url:"-"` + Digest string `json:"digest" url:"-"` + DigestType int `json:"digestType" url:"-"` + KeyTag int `json:"keyTag" url:"-"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -49,35 +46,28 @@ func (c *CreateDnssecBody) SetDomainName(domainName string) { // SetAlgorithm sets the Algorithm field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (c *CreateDnssecBody) SetAlgorithm(algorithm *int) { +func (c *CreateDnssecBody) SetAlgorithm(algorithm int) { c.Algorithm = algorithm c.require(createDnssecBodyFieldAlgorithm) } // SetDigest sets the Digest field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (c *CreateDnssecBody) SetDigest(digest *string) { +func (c *CreateDnssecBody) SetDigest(digest string) { c.Digest = digest c.require(createDnssecBodyFieldDigest) } -// SetCreateDnssecBodyDomainName sets the CreateDnssecBodyDomainName field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (c *CreateDnssecBody) SetCreateDnssecBodyDomainName(createDnssecBodyDomainName *string) { - c.CreateDnssecBodyDomainName = createDnssecBodyDomainName - c.require(createDnssecBodyFieldCreateDnssecBodyDomainName) -} - // SetDigestType sets the DigestType field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (c *CreateDnssecBody) SetDigestType(digestType *int) { +func (c *CreateDnssecBody) SetDigestType(digestType int) { c.DigestType = digestType c.require(createDnssecBodyFieldDigestType) } // SetKeyTag sets the KeyTag field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (c *CreateDnssecBody) SetKeyTag(keyTag *int) { +func (c *CreateDnssecBody) SetKeyTag(keyTag int) { c.KeyTag = keyTag c.require(createDnssecBodyFieldKeyTag) } diff --git a/dnsse_cs_test.go b/dnsse_cs_test.go index bf435b4..bb2fbc1 100644 --- a/dnsse_cs_test.go +++ b/dnsse_cs_test.go @@ -20,7 +20,7 @@ func TestSettersCreateDnssecBody(t *testing.T) { t.Run("SetAlgorithm", func(t *testing.T) { obj := &CreateDnssecBody{} - var fernTestValueAlgorithm *int + var fernTestValueAlgorithm int obj.SetAlgorithm(fernTestValueAlgorithm) assert.Equal(t, fernTestValueAlgorithm, obj.Algorithm) assert.NotNil(t, obj.explicitFields) @@ -28,23 +28,15 @@ func TestSettersCreateDnssecBody(t *testing.T) { t.Run("SetDigest", func(t *testing.T) { obj := &CreateDnssecBody{} - var fernTestValueDigest *string + var fernTestValueDigest string obj.SetDigest(fernTestValueDigest) assert.Equal(t, fernTestValueDigest, obj.Digest) assert.NotNil(t, obj.explicitFields) }) - t.Run("SetCreateDnssecBodyDomainName", func(t *testing.T) { - obj := &CreateDnssecBody{} - var fernTestValueCreateDnssecBodyDomainName *string - obj.SetCreateDnssecBodyDomainName(fernTestValueCreateDnssecBodyDomainName) - assert.Equal(t, fernTestValueCreateDnssecBodyDomainName, obj.CreateDnssecBodyDomainName) - assert.NotNil(t, obj.explicitFields) - }) - t.Run("SetDigestType", func(t *testing.T) { obj := &CreateDnssecBody{} - var fernTestValueDigestType *int + var fernTestValueDigestType int obj.SetDigestType(fernTestValueDigestType) assert.Equal(t, fernTestValueDigestType, obj.DigestType) assert.NotNil(t, obj.explicitFields) @@ -52,7 +44,7 @@ func TestSettersCreateDnssecBody(t *testing.T) { t.Run("SetKeyTag", func(t *testing.T) { obj := &CreateDnssecBody{} - var fernTestValueKeyTag *int + var fernTestValueKeyTag int obj.SetKeyTag(fernTestValueKeyTag) assert.Equal(t, fernTestValueKeyTag, obj.KeyTag) assert.NotNil(t, obj.explicitFields) @@ -96,7 +88,7 @@ func TestSettersMarkExplicitCreateDnssecBody(t *testing.T) { t.Parallel() // Arrange obj := &CreateDnssecBody{} - var fernTestValueAlgorithm *int + var fernTestValueAlgorithm int // Act obj.SetAlgorithm(fernTestValueAlgorithm) @@ -127,7 +119,7 @@ func TestSettersMarkExplicitCreateDnssecBody(t *testing.T) { t.Parallel() // Arrange obj := &CreateDnssecBody{} - var fernTestValueDigest *string + var fernTestValueDigest string // Act obj.SetDigest(fernTestValueDigest) @@ -154,42 +146,11 @@ func TestSettersMarkExplicitCreateDnssecBody(t *testing.T) { // It verifies that setting a field via setter allows successful JSON round-trip }) - t.Run("SetCreateDnssecBodyDomainName_MarksExplicit", func(t *testing.T) { - t.Parallel() - // Arrange - obj := &CreateDnssecBody{} - var fernTestValueCreateDnssecBodyDomainName *string - - // Act - obj.SetCreateDnssecBodyDomainName(fernTestValueCreateDnssecBodyDomainName) - - // Assert - object with explicitly set field can be marshaled/unmarshaled - bytes, err := json.Marshal(obj) - require.NoError(t, err, "marshaling should succeed for test setup") - - // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value - // Detect if marshaled JSON is an object or primitive to use correct unmarshal target - if len(bytes) > 0 && bytes[0] == '{' { - // JSON object - unmarshal into map - var unmarshaled map[string]interface{} - err = json.Unmarshal(bytes, &unmarshaled) - require.NoError(t, err, "unmarshaling should succeed for test verification") - } else { - // JSON primitive (string, number, boolean, null) - unmarshal into interface{} - var unmarshaled interface{} - err = json.Unmarshal(bytes, &unmarshaled) - require.NoError(t, err, "unmarshaling should succeed for test verification") - } - - // Note: This does not explicitly assert the presence of a specific JSON field - // It verifies that setting a field via setter allows successful JSON round-trip - }) - t.Run("SetDigestType_MarksExplicit", func(t *testing.T) { t.Parallel() // Arrange obj := &CreateDnssecBody{} - var fernTestValueDigestType *int + var fernTestValueDigestType int // Act obj.SetDigestType(fernTestValueDigestType) @@ -220,7 +181,7 @@ func TestSettersMarkExplicitCreateDnssecBody(t *testing.T) { t.Parallel() // Arrange obj := &CreateDnssecBody{} - var fernTestValueKeyTag *int + var fernTestValueKeyTag int // Act obj.SetKeyTag(fernTestValueKeyTag) diff --git a/dnssecs/dnsse_cs_test/dnsse_cs_test.go b/dnssecs/dnsse_cs_test/dnsse_cs_test.go index f7dbdb3..081de13 100644 --- a/dnssecs/dnsse_cs_test/dnsse_cs_test.go +++ b/dnssecs/dnsse_cs_test/dnsse_cs_test.go @@ -116,6 +116,10 @@ func TestDnsseCsCreateDnssecWithWireMock( ) request := &coreapigo.CreateDnssecBody{ DomainName: "domainName", + Algorithm: 1, + Digest: "digest", + DigestType: 1, + KeyTag: 1, } _, invocationErr := client.DnsseCs.CreateDnssec( context.TODO(), diff --git a/environments.go b/environments.go index 2111458..3dc1959 100644 --- a/environments.go +++ b/environments.go @@ -7,7 +7,9 @@ package api // RequestOption to override the client's default environment, // if any. var Environments = struct { - Default string + Sandbox string + Production string }{ - Default: "https://api.dev.name.com", + Sandbox: "https://api.dev.name.com", + Production: "https://api.name.com", } diff --git a/reference.md b/reference.md index bec5a20..f519655 100644 --- a/reference.md +++ b/reference.md @@ -1873,6 +1873,10 @@ Adds (registers) a new DNSSEC DS record for a domain. ```go request := &coreapigo.CreateDnssecBody{ DomainName: "domainName", + Algorithm: 1, + Digest: "digest", + DigestType: 1, + KeyTag: 1, } client.DnsseCs.CreateDnssec( context.TODO(), @@ -1901,15 +1905,7 @@ client.DnsseCs.CreateDnssec(
-**algorithm:** `*int` - -
-
- -
-
- -**digest:** `*string` — Digest is a digest of the DNSKEY RR that is registered with the registry. +**algorithm:** `int`
@@ -1917,7 +1913,7 @@ client.DnsseCs.CreateDnssec(
-**createDnssecBodyDomainName:** `*string` — The name of the domain. +**digest:** `string` — Digest is a digest of the DNSKEY RR that is registered with the registry.
@@ -1925,7 +1921,7 @@ client.DnsseCs.CreateDnssec(
-**digestType:** `*int` +**digestType:** `int`
@@ -1933,7 +1929,7 @@ client.DnsseCs.CreateDnssec(
-**keyTag:** `*int` +**keyTag:** `int`
@@ -3051,10 +3047,10 @@ Sets up a new URL forwarding (redirect) for a domain or subdomain. If this is th ```go request := &coreapigo.CreateURLForwardingRequest{ DomainName: "example.com", - Body: &coreapigo.URLForwarding{ + Body: &coreapigo.URLForwardingInput{ ForwardsTo: "https://destination-site.com", Host: "www", - Type: coreapigo.URLForwardingTypeMasked, + Type: coreapigo.URLForwardingInputTypeMasked, }, } client.URLForwardings.CreateURLForwarding( @@ -3084,7 +3080,7 @@ client.URLForwardings.CreateURLForwarding(
-**request:** `coreapigo.CreateURLForwardingBody` +**request:** `*coreapigo.URLForwardingInput`
@@ -3196,9 +3192,10 @@ Modifies an existing URL forwarding rule. Changes may take up to 24 hours to ful request := &coreapigo.UpdateURLForwardingRequest{ DomainName: "example.com", Host: "www.example.org", - Body: &coreapigo.UpdateURLForwardingBody{ + Body: &coreapigo.URLForwardingInput{ ForwardsTo: "https://destination-site.com", - Type: coreapigo.URLForwardingTypeMasked, + Host: "www", + Type: coreapigo.URLForwardingInputTypeMasked, }, } client.URLForwardings.UpdateURLForwarding( @@ -3236,7 +3233,7 @@ client.URLForwardings.UpdateURLForwarding(
-**request:** `*coreapigo.UpdateURLForwardingBody` +**request:** `*coreapigo.URLForwardingInput`
@@ -3571,9 +3568,10 @@ Modifies an existing URL forwarding rule by ID. The domain must be owned by the request := &coreapigo.UpdateURLForwardingByIDRequest{ DomainName: "example.com", ID: 12345, - Body: &coreapigo.UpdateURLForwardingBody{ + Body: &coreapigo.URLForwardingInput{ ForwardsTo: "https://destination-site.com", - Type: coreapigo.URLForwardingTypeMasked, + Host: "www", + Type: coreapigo.URLForwardingInputTypeMasked, }, } client.URLForwardings.UpdateURLForwardingByID( @@ -3611,7 +3609,7 @@ client.URLForwardings.UpdateURLForwardingByID(
-**request:** `*coreapigo.UpdateURLForwardingBody` +**request:** `*coreapigo.URLForwardingInput`
@@ -4068,9 +4066,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. diff --git a/types.go b/types.go index c4e693e..cdccedc 100644 --- a/types.go +++ b/types.go @@ -2006,6 +2006,154 @@ func (c *ContactsRequest) String() string { // The date and time when the domain was created at the registry. type CreateDate = time.Time +// Payload sent when a domain in the subscribing account expires and the grace period starts. This event is informational; it is separate from lock, removal, and transfer-out events. +var ( + domainExpirationFieldEventName = big.NewInt(1 << 0) + domainExpirationFieldDomainName = big.NewInt(1 << 1) + domainExpirationFieldExpirationDate = big.NewInt(1 << 2) +) + +type DomainExpiration struct { + // The name of the subscription event. + EventName DomainExpirationEventName `json:"eventName" url:"eventName"` + // The name of the expired domain. + DomainName string `json:"domainName" url:"domainName"` + // The date and time when the domain expired. + ExpirationDate time.Time `json:"expirationDate" url:"expirationDate"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (d *DomainExpiration) GetEventName() DomainExpirationEventName { + if d == nil { + return "" + } + return d.EventName +} + +func (d *DomainExpiration) GetDomainName() string { + if d == nil { + return "" + } + return d.DomainName +} + +func (d *DomainExpiration) GetExpirationDate() time.Time { + if d == nil { + return time.Time{} + } + return d.ExpirationDate +} + +func (d *DomainExpiration) GetExtraProperties() map[string]interface{} { + if d == nil { + return nil + } + return d.extraProperties +} + +func (d *DomainExpiration) require(field *big.Int) { + if d.explicitFields == nil { + d.explicitFields = big.NewInt(0) + } + d.explicitFields.Or(d.explicitFields, field) +} + +// SetEventName sets the EventName field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (d *DomainExpiration) SetEventName(eventName DomainExpirationEventName) { + d.EventName = eventName + d.require(domainExpirationFieldEventName) +} + +// SetDomainName sets the DomainName field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (d *DomainExpiration) SetDomainName(domainName string) { + d.DomainName = domainName + d.require(domainExpirationFieldDomainName) +} + +// SetExpirationDate sets the ExpirationDate field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (d *DomainExpiration) SetExpirationDate(expirationDate time.Time) { + d.ExpirationDate = expirationDate + d.require(domainExpirationFieldExpirationDate) +} + +func (d *DomainExpiration) UnmarshalJSON(data []byte) error { + type embed DomainExpiration + var unmarshaler = struct { + embed + ExpirationDate *internal.DateTime `json:"expirationDate"` + }{ + embed: embed(*d), + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + *d = DomainExpiration(unmarshaler.embed) + d.ExpirationDate = unmarshaler.ExpirationDate.Time() + extraProperties, err := internal.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) + return nil +} + +func (d *DomainExpiration) MarshalJSON() ([]byte, error) { + type embed DomainExpiration + var marshaler = struct { + embed + ExpirationDate *internal.DateTime `json:"expirationDate"` + }{ + embed: embed(*d), + ExpirationDate: internal.NewDateTime(d.ExpirationDate), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, d.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (d *DomainExpiration) String() string { + if d == nil { + return "" + } + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// The name of the subscription event. +type DomainExpirationEventName string + +const ( + DomainExpirationEventNameDomainExpiration DomainExpirationEventName = "domain.expiration" +) + +func NewDomainExpirationEventNameFromString(s string) (DomainExpirationEventName, error) { + switch s { + case "domain.expiration": + return DomainExpirationEventNameDomainExpiration, nil + } + var t DomainExpirationEventName + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (d DomainExpirationEventName) Ptr() *DomainExpirationEventName { + return &d +} + var ( domainLockStatusChangeFieldEventName = big.NewInt(1 << 0) domainLockStatusChangeFieldDomainName = big.NewInt(1 << 1) @@ -2919,6 +3067,239 @@ func (d DomainTransferInternalInStatusChangeStatus) Ptr() *DomainTransferInterna return &d } +// Payload sent when a domain transfers OUT from the webhook subscriber's account to another name.com account. +var ( + domainTransferInternalOutStatusChangeFieldEventName = big.NewInt(1 << 0) + domainTransferInternalOutStatusChangeFieldTransferID = big.NewInt(1 << 1) + domainTransferInternalOutStatusChangeFieldSourceAccountID = big.NewInt(1 << 2) + domainTransferInternalOutStatusChangeFieldDestinationAccountID = big.NewInt(1 << 3) + domainTransferInternalOutStatusChangeFieldStatus = big.NewInt(1 << 4) + domainTransferInternalOutStatusChangeFieldOccurredAt = big.NewInt(1 << 5) + domainTransferInternalOutStatusChangeFieldDomain = big.NewInt(1 << 6) +) + +type DomainTransferInternalOutStatusChange struct { + // The name of the subscription event. + EventName DomainTransferInternalOutStatusChangeEventName `json:"eventName" url:"eventName"` + // The internal transfer ID for this move, when available. Omitted when no transfer ID has been assigned for the event. + TransferID *int `json:"transferId,omitempty" url:"transferId,omitempty"` + // The account id that previously owned the domain (the losing account). + SourceAccountID int `json:"sourceAccountId" url:"sourceAccountId"` + // The account id that now owns the domain (the gaining account). + DestinationAccountID int `json:"destinationAccountId" url:"destinationAccountId"` + Status DomainTransferInternalOutStatusChangeStatus `json:"status" url:"status"` + // When the domain transfer out occurred. + OccurredAt time.Time `json:"occurredAt" url:"occurredAt"` + Domain *DomainResponsePayload `json:"domain" url:"domain"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (d *DomainTransferInternalOutStatusChange) GetEventName() DomainTransferInternalOutStatusChangeEventName { + if d == nil { + return "" + } + return d.EventName +} + +func (d *DomainTransferInternalOutStatusChange) GetTransferID() *int { + if d == nil { + return nil + } + return d.TransferID +} + +func (d *DomainTransferInternalOutStatusChange) GetSourceAccountID() int { + if d == nil { + return 0 + } + return d.SourceAccountID +} + +func (d *DomainTransferInternalOutStatusChange) GetDestinationAccountID() int { + if d == nil { + return 0 + } + return d.DestinationAccountID +} + +func (d *DomainTransferInternalOutStatusChange) GetStatus() DomainTransferInternalOutStatusChangeStatus { + if d == nil { + return "" + } + return d.Status +} + +func (d *DomainTransferInternalOutStatusChange) GetOccurredAt() time.Time { + if d == nil { + return time.Time{} + } + return d.OccurredAt +} + +func (d *DomainTransferInternalOutStatusChange) GetDomain() *DomainResponsePayload { + if d == nil { + return nil + } + return d.Domain +} + +func (d *DomainTransferInternalOutStatusChange) GetExtraProperties() map[string]interface{} { + if d == nil { + return nil + } + return d.extraProperties +} + +func (d *DomainTransferInternalOutStatusChange) require(field *big.Int) { + if d.explicitFields == nil { + d.explicitFields = big.NewInt(0) + } + d.explicitFields.Or(d.explicitFields, field) +} + +// SetEventName sets the EventName field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (d *DomainTransferInternalOutStatusChange) SetEventName(eventName DomainTransferInternalOutStatusChangeEventName) { + d.EventName = eventName + d.require(domainTransferInternalOutStatusChangeFieldEventName) +} + +// SetTransferID sets the TransferID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (d *DomainTransferInternalOutStatusChange) SetTransferID(transferID *int) { + d.TransferID = transferID + d.require(domainTransferInternalOutStatusChangeFieldTransferID) +} + +// SetSourceAccountID sets the SourceAccountID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (d *DomainTransferInternalOutStatusChange) SetSourceAccountID(sourceAccountID int) { + d.SourceAccountID = sourceAccountID + d.require(domainTransferInternalOutStatusChangeFieldSourceAccountID) +} + +// SetDestinationAccountID sets the DestinationAccountID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (d *DomainTransferInternalOutStatusChange) SetDestinationAccountID(destinationAccountID int) { + d.DestinationAccountID = destinationAccountID + d.require(domainTransferInternalOutStatusChangeFieldDestinationAccountID) +} + +// SetStatus sets the Status field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (d *DomainTransferInternalOutStatusChange) SetStatus(status DomainTransferInternalOutStatusChangeStatus) { + d.Status = status + d.require(domainTransferInternalOutStatusChangeFieldStatus) +} + +// SetOccurredAt sets the OccurredAt field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (d *DomainTransferInternalOutStatusChange) SetOccurredAt(occurredAt time.Time) { + d.OccurredAt = occurredAt + d.require(domainTransferInternalOutStatusChangeFieldOccurredAt) +} + +// SetDomain sets the Domain field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (d *DomainTransferInternalOutStatusChange) SetDomain(domain *DomainResponsePayload) { + d.Domain = domain + d.require(domainTransferInternalOutStatusChangeFieldDomain) +} + +func (d *DomainTransferInternalOutStatusChange) UnmarshalJSON(data []byte) error { + type embed DomainTransferInternalOutStatusChange + var unmarshaler = struct { + embed + OccurredAt *internal.DateTime `json:"occurredAt"` + }{ + embed: embed(*d), + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + *d = DomainTransferInternalOutStatusChange(unmarshaler.embed) + d.OccurredAt = unmarshaler.OccurredAt.Time() + extraProperties, err := internal.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) + return nil +} + +func (d *DomainTransferInternalOutStatusChange) MarshalJSON() ([]byte, error) { + type embed DomainTransferInternalOutStatusChange + var marshaler = struct { + embed + OccurredAt *internal.DateTime `json:"occurredAt"` + }{ + embed: embed(*d), + OccurredAt: internal.NewDateTime(d.OccurredAt), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, d.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (d *DomainTransferInternalOutStatusChange) String() string { + if d == nil { + return "" + } + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// The name of the subscription event. +type DomainTransferInternalOutStatusChangeEventName string + +const ( + DomainTransferInternalOutStatusChangeEventNameDomainTransferInternalOut DomainTransferInternalOutStatusChangeEventName = "domain.transfer.internal_out" +) + +func NewDomainTransferInternalOutStatusChangeEventNameFromString(s string) (DomainTransferInternalOutStatusChangeEventName, error) { + switch s { + case "domain.transfer.internal_out": + return DomainTransferInternalOutStatusChangeEventNameDomainTransferInternalOut, nil + } + var t DomainTransferInternalOutStatusChangeEventName + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (d DomainTransferInternalOutStatusChangeEventName) Ptr() *DomainTransferInternalOutStatusChangeEventName { + return &d +} + +type DomainTransferInternalOutStatusChangeStatus string + +const ( + DomainTransferInternalOutStatusChangeStatusCompleted DomainTransferInternalOutStatusChangeStatus = "completed" +) + +func NewDomainTransferInternalOutStatusChangeStatusFromString(s string) (DomainTransferInternalOutStatusChangeStatus, error) { + switch s { + case "completed": + return DomainTransferInternalOutStatusChangeStatusCompleted, nil + } + var t DomainTransferInternalOutStatusChangeStatus + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (d DomainTransferInternalOutStatusChangeStatus) Ptr() *DomainTransferInternalOutStatusChangeStatus { + return &d +} + // Payload sent when a domain transfer OUT from name.com to another registrar has a status change (initiated, completed, or canceled). When status is "completed", the domain has been removed from name.com. In some edge cases (including near-expiration scenarios) the data may not be fully accurate. var ( domainTransferOutStatusChangeFieldEventName = big.NewInt(1 << 0) @@ -5650,6 +6031,183 @@ func (u *UnsupportedMedia415) String() string { return fmt.Sprintf("%#v", u) } +// URLForwarding represents a URL forwarding entry, allowing a domain to redirect to another URL using different forwarding methods. +var ( + uRLForwardingFieldDomainName = big.NewInt(1 << 0) + uRLForwardingFieldForwardsTo = big.NewInt(1 << 1) + uRLForwardingFieldHost = big.NewInt(1 << 2) + uRLForwardingFieldMeta = big.NewInt(1 << 3) + uRLForwardingFieldTitle = big.NewInt(1 << 4) + uRLForwardingFieldType = big.NewInt(1 << 5) +) + +type URLForwarding struct { + // The domain name (without subdomains) that is being forwarded. + DomainName *string `json:"domainName,omitempty" url:"domainName,omitempty"` + // The destination URL to which this hostname will be forwarded. + ForwardsTo string `json:"forwardsTo" url:"forwardsTo"` + // The subdomain portion of the hostname that is being forwarded. + Host string `json:"host" url:"host"` + // Meta tags to include in the HTML page when using "masked" forwarding. + // Ignored for other forwarding types. + // Example: `` + Meta *string `json:"meta,omitempty" url:"meta,omitempty"` + // The title to be used for the HTML page when using "masked" forwarding. + // Ignored for other forwarding types. + Title *string `json:"title,omitempty" url:"title,omitempty"` + // The type of URL forwarding. Valid values: + // - `masked`: Retains the original domain in the address bar, preventing the user from seeing the actual destination URL. Sometimes called iframe forwarding. + // - `redirect`: Uses a standard HTTP redirect (301), which changes the address bar to the destination URL. + // - `302`: Uses a temporary HTTP redirect (302), which changes the address bar to the destination URL but indicates the resource is temporarily located elsewhere. + Type URLForwardingType `json:"type" url:"type"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (u *URLForwarding) GetDomainName() *string { + if u == nil { + return nil + } + return u.DomainName +} + +func (u *URLForwarding) GetForwardsTo() string { + if u == nil { + return "" + } + return u.ForwardsTo +} + +func (u *URLForwarding) GetHost() string { + if u == nil { + return "" + } + return u.Host +} + +func (u *URLForwarding) GetMeta() *string { + if u == nil { + return nil + } + return u.Meta +} + +func (u *URLForwarding) GetTitle() *string { + if u == nil { + return nil + } + return u.Title +} + +func (u *URLForwarding) GetType() URLForwardingType { + if u == nil { + return "" + } + return u.Type +} + +func (u *URLForwarding) GetExtraProperties() map[string]interface{} { + if u == nil { + return nil + } + return u.extraProperties +} + +func (u *URLForwarding) require(field *big.Int) { + if u.explicitFields == nil { + u.explicitFields = big.NewInt(0) + } + u.explicitFields.Or(u.explicitFields, field) +} + +// SetDomainName sets the DomainName field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (u *URLForwarding) SetDomainName(domainName *string) { + u.DomainName = domainName + u.require(uRLForwardingFieldDomainName) +} + +// SetForwardsTo sets the ForwardsTo field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (u *URLForwarding) SetForwardsTo(forwardsTo string) { + u.ForwardsTo = forwardsTo + u.require(uRLForwardingFieldForwardsTo) +} + +// SetHost sets the Host field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (u *URLForwarding) SetHost(host string) { + u.Host = host + u.require(uRLForwardingFieldHost) +} + +// SetMeta sets the Meta field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (u *URLForwarding) SetMeta(meta *string) { + u.Meta = meta + u.require(uRLForwardingFieldMeta) +} + +// SetTitle sets the Title field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (u *URLForwarding) SetTitle(title *string) { + u.Title = title + u.require(uRLForwardingFieldTitle) +} + +// SetType sets the Type field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (u *URLForwarding) SetType(type_ URLForwardingType) { + u.Type = type_ + u.require(uRLForwardingFieldType) +} + +func (u *URLForwarding) UnmarshalJSON(data []byte) error { + type unmarshaler URLForwarding + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *u = URLForwarding(value) + extraProperties, err := internal.ExtractExtraProperties(data, *u) + if err != nil { + return err + } + u.extraProperties = extraProperties + u.rawJSON = json.RawMessage(data) + return nil +} + +func (u *URLForwarding) MarshalJSON() ([]byte, error) { + type embed URLForwarding + var marshaler = struct { + embed + }{ + embed: embed(*u), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, u.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (u *URLForwarding) String() string { + if u == nil { + return "" + } + if len(u.rawJSON) > 0 { + if value, err := internal.StringifyJSON(u.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(u); err == nil { + return value + } + return fmt.Sprintf("%#v", u) +} + // VanityNameserver represents a custom nameserver associated with a domain, including its hostname and a list of IP addresses for glue records. var ( vanityNameserverFieldDomainName = big.NewInt(1 << 0) diff --git a/types_test.go b/types_test.go index d3dbb3a..d16d145 100644 --- a/types_test.go +++ b/types_test.go @@ -4110,6 +4110,201 @@ func TestSettersMarkExplicitContactsRequest(t *testing.T) { } +func TestSettersDomainExpiration(t *testing.T) { + t.Run("SetEventName", func(t *testing.T) { + obj := &DomainExpiration{} + var fernTestValueEventName DomainExpirationEventName + obj.SetEventName(fernTestValueEventName) + assert.Equal(t, fernTestValueEventName, obj.EventName) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetDomainName", func(t *testing.T) { + obj := &DomainExpiration{} + var fernTestValueDomainName string + obj.SetDomainName(fernTestValueDomainName) + assert.Equal(t, fernTestValueDomainName, obj.DomainName) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetExpirationDate", func(t *testing.T) { + obj := &DomainExpiration{} + var fernTestValueExpirationDate time.Time + obj.SetExpirationDate(fernTestValueExpirationDate) + assert.Equal(t, fernTestValueExpirationDate, obj.ExpirationDate) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersDomainExpiration(t *testing.T) { + t.Run("GetEventName", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DomainExpiration{} + var expected DomainExpirationEventName + obj.EventName = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetEventName(), "getter should return the property value") + }) + + t.Run("GetEventName_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DomainExpiration + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetEventName() // Should return zero value + }) + + t.Run("GetDomainName", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DomainExpiration{} + var expected string + obj.DomainName = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetDomainName(), "getter should return the property value") + }) + + t.Run("GetDomainName_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DomainExpiration + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetDomainName() // Should return zero value + }) + + t.Run("GetExpirationDate", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DomainExpiration{} + var expected time.Time + obj.ExpirationDate = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetExpirationDate(), "getter should return the property value") + }) + + t.Run("GetExpirationDate_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DomainExpiration + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetExpirationDate() // Should return zero value + }) + +} + +func TestSettersMarkExplicitDomainExpiration(t *testing.T) { + t.Run("SetEventName_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DomainExpiration{} + var fernTestValueEventName DomainExpirationEventName + + // Act + obj.SetEventName(fernTestValueEventName) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetDomainName_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DomainExpiration{} + var fernTestValueDomainName string + + // Act + obj.SetDomainName(fernTestValueDomainName) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetExpirationDate_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DomainExpiration{} + var fernTestValueExpirationDate time.Time + + // Act + obj.SetExpirationDate(fernTestValueExpirationDate) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + func TestSettersDomainLockStatusChange(t *testing.T) { t.Run("SetEventName", func(t *testing.T) { obj := &DomainLockStatusChange{} @@ -5972,47 +6167,71 @@ func TestSettersMarkExplicitDomainTransferInternalInStatusChange(t *testing.T) { } -func TestSettersDomainTransferOutStatusChange(t *testing.T) { +func TestSettersDomainTransferInternalOutStatusChange(t *testing.T) { t.Run("SetEventName", func(t *testing.T) { - obj := &DomainTransferOutStatusChange{} - var fernTestValueEventName DomainTransferOutStatusChangeEventName + obj := &DomainTransferInternalOutStatusChange{} + var fernTestValueEventName DomainTransferInternalOutStatusChangeEventName obj.SetEventName(fernTestValueEventName) assert.Equal(t, fernTestValueEventName, obj.EventName) assert.NotNil(t, obj.explicitFields) }) - t.Run("SetDomainName", func(t *testing.T) { - obj := &DomainTransferOutStatusChange{} - var fernTestValueDomainName string - obj.SetDomainName(fernTestValueDomainName) - assert.Equal(t, fernTestValueDomainName, obj.DomainName) + t.Run("SetTransferID", func(t *testing.T) { + obj := &DomainTransferInternalOutStatusChange{} + var fernTestValueTransferID *int + obj.SetTransferID(fernTestValueTransferID) + assert.Equal(t, fernTestValueTransferID, obj.TransferID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetSourceAccountID", func(t *testing.T) { + obj := &DomainTransferInternalOutStatusChange{} + var fernTestValueSourceAccountID int + obj.SetSourceAccountID(fernTestValueSourceAccountID) + assert.Equal(t, fernTestValueSourceAccountID, obj.SourceAccountID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetDestinationAccountID", func(t *testing.T) { + obj := &DomainTransferInternalOutStatusChange{} + var fernTestValueDestinationAccountID int + obj.SetDestinationAccountID(fernTestValueDestinationAccountID) + assert.Equal(t, fernTestValueDestinationAccountID, obj.DestinationAccountID) assert.NotNil(t, obj.explicitFields) }) t.Run("SetStatus", func(t *testing.T) { - obj := &DomainTransferOutStatusChange{} - var fernTestValueStatus DomainTransferOutStatusChangeStatus + obj := &DomainTransferInternalOutStatusChange{} + var fernTestValueStatus DomainTransferInternalOutStatusChangeStatus obj.SetStatus(fernTestValueStatus) assert.Equal(t, fernTestValueStatus, obj.Status) assert.NotNil(t, obj.explicitFields) }) - t.Run("SetRegistryClientID", func(t *testing.T) { - obj := &DomainTransferOutStatusChange{} - var fernTestValueRegistryClientID *string - obj.SetRegistryClientID(fernTestValueRegistryClientID) - assert.Equal(t, fernTestValueRegistryClientID, obj.RegistryClientID) + t.Run("SetOccurredAt", func(t *testing.T) { + obj := &DomainTransferInternalOutStatusChange{} + var fernTestValueOccurredAt time.Time + obj.SetOccurredAt(fernTestValueOccurredAt) + assert.Equal(t, fernTestValueOccurredAt, obj.OccurredAt) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetDomain", func(t *testing.T) { + obj := &DomainTransferInternalOutStatusChange{} + var fernTestValueDomain *DomainResponsePayload + obj.SetDomain(fernTestValueDomain) + assert.Equal(t, fernTestValueDomain, obj.Domain) assert.NotNil(t, obj.explicitFields) }) } -func TestGettersDomainTransferOutStatusChange(t *testing.T) { +func TestGettersDomainTransferInternalOutStatusChange(t *testing.T) { t.Run("GetEventName", func(t *testing.T) { t.Parallel() // Arrange - obj := &DomainTransferOutStatusChange{} - var expected DomainTransferOutStatusChangeEventName + obj := &DomainTransferInternalOutStatusChange{} + var expected DomainTransferInternalOutStatusChangeEventName obj.EventName = expected // Act & Assert @@ -6021,7 +6240,7 @@ func TestGettersDomainTransferOutStatusChange(t *testing.T) { t.Run("GetEventName_NilReceiver", func(t *testing.T) { t.Parallel() - var obj *DomainTransferOutStatusChange + var obj *DomainTransferInternalOutStatusChange // Should not panic - getters should handle nil receiver gracefully defer func() { if r := recover(); r != nil { @@ -6031,93 +6250,172 @@ func TestGettersDomainTransferOutStatusChange(t *testing.T) { _ = obj.GetEventName() // Should return zero value }) - t.Run("GetDomainName", func(t *testing.T) { + t.Run("GetTransferID", func(t *testing.T) { t.Parallel() // Arrange - obj := &DomainTransferOutStatusChange{} - var expected string - obj.DomainName = expected + obj := &DomainTransferInternalOutStatusChange{} + var expected *int + obj.TransferID = expected // Act & Assert - assert.Equal(t, expected, obj.GetDomainName(), "getter should return the property value") + assert.Equal(t, expected, obj.GetTransferID(), "getter should return the property value") }) - t.Run("GetDomainName_NilReceiver", func(t *testing.T) { + t.Run("GetTransferID_NilValue", func(t *testing.T) { t.Parallel() - var obj *DomainTransferOutStatusChange + // Arrange + obj := &DomainTransferInternalOutStatusChange{} + obj.TransferID = nil + + // Act & Assert + assert.Nil(t, obj.GetTransferID(), "getter should return nil when property is nil") + }) + + t.Run("GetTransferID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DomainTransferInternalOutStatusChange // Should not panic - getters should handle nil receiver gracefully defer func() { if r := recover(); r != nil { t.Errorf("Getter panicked on nil receiver: %v", r) } }() - _ = obj.GetDomainName() // Should return zero value + _ = obj.GetTransferID() // Should return zero value }) - t.Run("GetStatus", func(t *testing.T) { + t.Run("GetSourceAccountID", func(t *testing.T) { t.Parallel() // Arrange - obj := &DomainTransferOutStatusChange{} - var expected DomainTransferOutStatusChangeStatus - obj.Status = expected + obj := &DomainTransferInternalOutStatusChange{} + var expected int + obj.SourceAccountID = expected // Act & Assert - assert.Equal(t, expected, obj.GetStatus(), "getter should return the property value") + assert.Equal(t, expected, obj.GetSourceAccountID(), "getter should return the property value") }) - t.Run("GetStatus_NilReceiver", func(t *testing.T) { + t.Run("GetSourceAccountID_NilReceiver", func(t *testing.T) { t.Parallel() - var obj *DomainTransferOutStatusChange + var obj *DomainTransferInternalOutStatusChange // Should not panic - getters should handle nil receiver gracefully defer func() { if r := recover(); r != nil { t.Errorf("Getter panicked on nil receiver: %v", r) } }() - _ = obj.GetStatus() // Should return zero value + _ = obj.GetSourceAccountID() // Should return zero value }) - t.Run("GetRegistryClientID", func(t *testing.T) { + t.Run("GetDestinationAccountID", func(t *testing.T) { t.Parallel() // Arrange - obj := &DomainTransferOutStatusChange{} - var expected *string - obj.RegistryClientID = expected + obj := &DomainTransferInternalOutStatusChange{} + var expected int + obj.DestinationAccountID = expected // Act & Assert - assert.Equal(t, expected, obj.GetRegistryClientID(), "getter should return the property value") + assert.Equal(t, expected, obj.GetDestinationAccountID(), "getter should return the property value") }) - t.Run("GetRegistryClientID_NilValue", func(t *testing.T) { + t.Run("GetDestinationAccountID_NilReceiver", func(t *testing.T) { t.Parallel() - // Arrange - obj := &DomainTransferOutStatusChange{} - obj.RegistryClientID = nil - - // Act & Assert - assert.Nil(t, obj.GetRegistryClientID(), "getter should return nil when property is nil") - }) + var obj *DomainTransferInternalOutStatusChange + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetDestinationAccountID() // Should return zero value + }) - t.Run("GetRegistryClientID_NilReceiver", func(t *testing.T) { + t.Run("GetStatus", func(t *testing.T) { t.Parallel() - var obj *DomainTransferOutStatusChange + // Arrange + obj := &DomainTransferInternalOutStatusChange{} + var expected DomainTransferInternalOutStatusChangeStatus + obj.Status = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetStatus(), "getter should return the property value") + }) + + t.Run("GetStatus_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DomainTransferInternalOutStatusChange // Should not panic - getters should handle nil receiver gracefully defer func() { if r := recover(); r != nil { t.Errorf("Getter panicked on nil receiver: %v", r) } }() - _ = obj.GetRegistryClientID() // Should return zero value + _ = obj.GetStatus() // Should return zero value + }) + + t.Run("GetOccurredAt", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DomainTransferInternalOutStatusChange{} + var expected time.Time + obj.OccurredAt = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetOccurredAt(), "getter should return the property value") + }) + + t.Run("GetOccurredAt_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DomainTransferInternalOutStatusChange + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetOccurredAt() // Should return zero value + }) + + t.Run("GetDomain", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DomainTransferInternalOutStatusChange{} + var expected *DomainResponsePayload + obj.Domain = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetDomain(), "getter should return the property value") + }) + + t.Run("GetDomain_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DomainTransferInternalOutStatusChange{} + obj.Domain = nil + + // Act & Assert + assert.Nil(t, obj.GetDomain(), "getter should return nil when property is nil") + }) + + t.Run("GetDomain_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DomainTransferInternalOutStatusChange + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetDomain() // Should return zero value }) } -func TestSettersMarkExplicitDomainTransferOutStatusChange(t *testing.T) { +func TestSettersMarkExplicitDomainTransferInternalOutStatusChange(t *testing.T) { t.Run("SetEventName_MarksExplicit", func(t *testing.T) { t.Parallel() // Arrange - obj := &DomainTransferOutStatusChange{} - var fernTestValueEventName DomainTransferOutStatusChangeEventName + obj := &DomainTransferInternalOutStatusChange{} + var fernTestValueEventName DomainTransferInternalOutStatusChangeEventName // Act obj.SetEventName(fernTestValueEventName) @@ -6144,14 +6442,76 @@ func TestSettersMarkExplicitDomainTransferOutStatusChange(t *testing.T) { // It verifies that setting a field via setter allows successful JSON round-trip }) - t.Run("SetDomainName_MarksExplicit", func(t *testing.T) { + t.Run("SetTransferID_MarksExplicit", func(t *testing.T) { t.Parallel() // Arrange - obj := &DomainTransferOutStatusChange{} - var fernTestValueDomainName string + obj := &DomainTransferInternalOutStatusChange{} + var fernTestValueTransferID *int // Act - obj.SetDomainName(fernTestValueDomainName) + obj.SetTransferID(fernTestValueTransferID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetSourceAccountID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DomainTransferInternalOutStatusChange{} + var fernTestValueSourceAccountID int + + // Act + obj.SetSourceAccountID(fernTestValueSourceAccountID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetDestinationAccountID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DomainTransferInternalOutStatusChange{} + var fernTestValueDestinationAccountID int + + // Act + obj.SetDestinationAccountID(fernTestValueDestinationAccountID) // Assert - object with explicitly set field can be marshaled/unmarshaled bytes, err := json.Marshal(obj) @@ -6178,8 +6538,8 @@ func TestSettersMarkExplicitDomainTransferOutStatusChange(t *testing.T) { t.Run("SetStatus_MarksExplicit", func(t *testing.T) { t.Parallel() // Arrange - obj := &DomainTransferOutStatusChange{} - var fernTestValueStatus DomainTransferOutStatusChangeStatus + obj := &DomainTransferInternalOutStatusChange{} + var fernTestValueStatus DomainTransferInternalOutStatusChangeStatus // Act obj.SetStatus(fernTestValueStatus) @@ -6206,14 +6566,45 @@ func TestSettersMarkExplicitDomainTransferOutStatusChange(t *testing.T) { // It verifies that setting a field via setter allows successful JSON round-trip }) - t.Run("SetRegistryClientID_MarksExplicit", func(t *testing.T) { + t.Run("SetOccurredAt_MarksExplicit", func(t *testing.T) { t.Parallel() // Arrange - obj := &DomainTransferOutStatusChange{} - var fernTestValueRegistryClientID *string + obj := &DomainTransferInternalOutStatusChange{} + var fernTestValueOccurredAt time.Time // Act - obj.SetRegistryClientID(fernTestValueRegistryClientID) + obj.SetOccurredAt(fernTestValueOccurredAt) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetDomain_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DomainTransferInternalOutStatusChange{} + var fernTestValueDomain *DomainResponsePayload + + // Act + obj.SetDomain(fernTestValueDomain) // Assert - object with explicitly set field can be marshaled/unmarshaled bytes, err := json.Marshal(obj) @@ -6239,17 +6630,17 @@ func TestSettersMarkExplicitDomainTransferOutStatusChange(t *testing.T) { } -func TestSettersDomainTransferStatusChange(t *testing.T) { +func TestSettersDomainTransferOutStatusChange(t *testing.T) { t.Run("SetEventName", func(t *testing.T) { - obj := &DomainTransferStatusChange{} - var fernTestValueEventName DomainTransferStatusChangeEventName + obj := &DomainTransferOutStatusChange{} + var fernTestValueEventName DomainTransferOutStatusChangeEventName obj.SetEventName(fernTestValueEventName) assert.Equal(t, fernTestValueEventName, obj.EventName) assert.NotNil(t, obj.explicitFields) }) t.Run("SetDomainName", func(t *testing.T) { - obj := &DomainTransferStatusChange{} + obj := &DomainTransferOutStatusChange{} var fernTestValueDomainName string obj.SetDomainName(fernTestValueDomainName) assert.Equal(t, fernTestValueDomainName, obj.DomainName) @@ -6257,21 +6648,29 @@ func TestSettersDomainTransferStatusChange(t *testing.T) { }) t.Run("SetStatus", func(t *testing.T) { - obj := &DomainTransferStatusChange{} - var fernTestValueStatus TransferStatus + obj := &DomainTransferOutStatusChange{} + var fernTestValueStatus DomainTransferOutStatusChangeStatus obj.SetStatus(fernTestValueStatus) assert.Equal(t, fernTestValueStatus, obj.Status) assert.NotNil(t, obj.explicitFields) }) + t.Run("SetRegistryClientID", func(t *testing.T) { + obj := &DomainTransferOutStatusChange{} + var fernTestValueRegistryClientID *string + obj.SetRegistryClientID(fernTestValueRegistryClientID) + assert.Equal(t, fernTestValueRegistryClientID, obj.RegistryClientID) + assert.NotNil(t, obj.explicitFields) + }) + } -func TestGettersDomainTransferStatusChange(t *testing.T) { +func TestGettersDomainTransferOutStatusChange(t *testing.T) { t.Run("GetEventName", func(t *testing.T) { t.Parallel() // Arrange - obj := &DomainTransferStatusChange{} - var expected DomainTransferStatusChangeEventName + obj := &DomainTransferOutStatusChange{} + var expected DomainTransferOutStatusChangeEventName obj.EventName = expected // Act & Assert @@ -6280,7 +6679,7 @@ func TestGettersDomainTransferStatusChange(t *testing.T) { t.Run("GetEventName_NilReceiver", func(t *testing.T) { t.Parallel() - var obj *DomainTransferStatusChange + var obj *DomainTransferOutStatusChange // Should not panic - getters should handle nil receiver gracefully defer func() { if r := recover(); r != nil { @@ -6293,7 +6692,7 @@ func TestGettersDomainTransferStatusChange(t *testing.T) { t.Run("GetDomainName", func(t *testing.T) { t.Parallel() // Arrange - obj := &DomainTransferStatusChange{} + obj := &DomainTransferOutStatusChange{} var expected string obj.DomainName = expected @@ -6303,7 +6702,7 @@ func TestGettersDomainTransferStatusChange(t *testing.T) { t.Run("GetDomainName_NilReceiver", func(t *testing.T) { t.Parallel() - var obj *DomainTransferStatusChange + var obj *DomainTransferOutStatusChange // Should not panic - getters should handle nil receiver gracefully defer func() { if r := recover(); r != nil { @@ -6316,8 +6715,8 @@ func TestGettersDomainTransferStatusChange(t *testing.T) { t.Run("GetStatus", func(t *testing.T) { t.Parallel() // Arrange - obj := &DomainTransferStatusChange{} - var expected TransferStatus + obj := &DomainTransferOutStatusChange{} + var expected DomainTransferOutStatusChangeStatus obj.Status = expected // Act & Assert @@ -6326,7 +6725,7 @@ func TestGettersDomainTransferStatusChange(t *testing.T) { t.Run("GetStatus_NilReceiver", func(t *testing.T) { t.Parallel() - var obj *DomainTransferStatusChange + var obj *DomainTransferOutStatusChange // Should not panic - getters should handle nil receiver gracefully defer func() { if r := recover(); r != nil { @@ -6336,14 +6735,273 @@ func TestGettersDomainTransferStatusChange(t *testing.T) { _ = obj.GetStatus() // Should return zero value }) + t.Run("GetRegistryClientID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DomainTransferOutStatusChange{} + var expected *string + obj.RegistryClientID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetRegistryClientID(), "getter should return the property value") + }) + + t.Run("GetRegistryClientID_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DomainTransferOutStatusChange{} + obj.RegistryClientID = nil + + // Act & Assert + assert.Nil(t, obj.GetRegistryClientID(), "getter should return nil when property is nil") + }) + + t.Run("GetRegistryClientID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DomainTransferOutStatusChange + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetRegistryClientID() // Should return zero value + }) + } -func TestSettersMarkExplicitDomainTransferStatusChange(t *testing.T) { +func TestSettersMarkExplicitDomainTransferOutStatusChange(t *testing.T) { t.Run("SetEventName_MarksExplicit", func(t *testing.T) { t.Parallel() // Arrange - obj := &DomainTransferStatusChange{} - var fernTestValueEventName DomainTransferStatusChangeEventName + obj := &DomainTransferOutStatusChange{} + var fernTestValueEventName DomainTransferOutStatusChangeEventName + + // Act + obj.SetEventName(fernTestValueEventName) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetDomainName_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DomainTransferOutStatusChange{} + var fernTestValueDomainName string + + // Act + obj.SetDomainName(fernTestValueDomainName) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetStatus_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DomainTransferOutStatusChange{} + var fernTestValueStatus DomainTransferOutStatusChangeStatus + + // Act + obj.SetStatus(fernTestValueStatus) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetRegistryClientID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DomainTransferOutStatusChange{} + var fernTestValueRegistryClientID *string + + // Act + obj.SetRegistryClientID(fernTestValueRegistryClientID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersDomainTransferStatusChange(t *testing.T) { + t.Run("SetEventName", func(t *testing.T) { + obj := &DomainTransferStatusChange{} + var fernTestValueEventName DomainTransferStatusChangeEventName + obj.SetEventName(fernTestValueEventName) + assert.Equal(t, fernTestValueEventName, obj.EventName) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetDomainName", func(t *testing.T) { + obj := &DomainTransferStatusChange{} + var fernTestValueDomainName string + obj.SetDomainName(fernTestValueDomainName) + assert.Equal(t, fernTestValueDomainName, obj.DomainName) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetStatus", func(t *testing.T) { + obj := &DomainTransferStatusChange{} + var fernTestValueStatus TransferStatus + obj.SetStatus(fernTestValueStatus) + assert.Equal(t, fernTestValueStatus, obj.Status) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersDomainTransferStatusChange(t *testing.T) { + t.Run("GetEventName", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DomainTransferStatusChange{} + var expected DomainTransferStatusChangeEventName + obj.EventName = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetEventName(), "getter should return the property value") + }) + + t.Run("GetEventName_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DomainTransferStatusChange + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetEventName() // Should return zero value + }) + + t.Run("GetDomainName", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DomainTransferStatusChange{} + var expected string + obj.DomainName = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetDomainName(), "getter should return the property value") + }) + + t.Run("GetDomainName_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DomainTransferStatusChange + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetDomainName() // Should return zero value + }) + + t.Run("GetStatus", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DomainTransferStatusChange{} + var expected TransferStatus + obj.Status = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetStatus(), "getter should return the property value") + }) + + t.Run("GetStatus_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DomainTransferStatusChange + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetStatus() // Should return zero value + }) + +} + +func TestSettersMarkExplicitDomainTransferStatusChange(t *testing.T) { + t.Run("SetEventName_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DomainTransferStatusChange{} + var fernTestValueEventName DomainTransferStatusChangeEventName // Act obj.SetEventName(fernTestValueEventName) @@ -10686,29 +11344,440 @@ func TestGettersUnsupportedMedia415(t *testing.T) { assert.Equal(t, expected, obj.GetMessage(), "getter should return the property value") }) - t.Run("GetMessage_NilReceiver", func(t *testing.T) { - t.Parallel() - var obj *UnsupportedMedia415 - // Should not panic - getters should handle nil receiver gracefully - defer func() { - if r := recover(); r != nil { - t.Errorf("Getter panicked on nil receiver: %v", r) - } - }() - _ = obj.GetMessage() // Should return zero value + t.Run("GetMessage_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *UnsupportedMedia415 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetMessage() // Should return zero value + }) + +} + +func TestSettersMarkExplicitUnsupportedMedia415(t *testing.T) { + t.Run("SetMessage_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &UnsupportedMedia415{} + var fernTestValueMessage string + + // Act + obj.SetMessage(fernTestValueMessage) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersURLForwarding(t *testing.T) { + t.Run("SetDomainName", func(t *testing.T) { + obj := &URLForwarding{} + var fernTestValueDomainName *string + obj.SetDomainName(fernTestValueDomainName) + assert.Equal(t, fernTestValueDomainName, obj.DomainName) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetForwardsTo", func(t *testing.T) { + obj := &URLForwarding{} + var fernTestValueForwardsTo string + obj.SetForwardsTo(fernTestValueForwardsTo) + assert.Equal(t, fernTestValueForwardsTo, obj.ForwardsTo) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetHost", func(t *testing.T) { + obj := &URLForwarding{} + var fernTestValueHost string + obj.SetHost(fernTestValueHost) + assert.Equal(t, fernTestValueHost, obj.Host) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetMeta", func(t *testing.T) { + obj := &URLForwarding{} + var fernTestValueMeta *string + obj.SetMeta(fernTestValueMeta) + assert.Equal(t, fernTestValueMeta, obj.Meta) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetTitle", func(t *testing.T) { + obj := &URLForwarding{} + var fernTestValueTitle *string + obj.SetTitle(fernTestValueTitle) + assert.Equal(t, fernTestValueTitle, obj.Title) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetType", func(t *testing.T) { + obj := &URLForwarding{} + var fernTestValueType URLForwardingType + obj.SetType(fernTestValueType) + assert.Equal(t, fernTestValueType, obj.Type) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersURLForwarding(t *testing.T) { + t.Run("GetDomainName", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &URLForwarding{} + var expected *string + obj.DomainName = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetDomainName(), "getter should return the property value") + }) + + t.Run("GetDomainName_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &URLForwarding{} + obj.DomainName = nil + + // Act & Assert + assert.Nil(t, obj.GetDomainName(), "getter should return nil when property is nil") + }) + + t.Run("GetDomainName_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *URLForwarding + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetDomainName() // Should return zero value + }) + + t.Run("GetForwardsTo", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &URLForwarding{} + var expected string + obj.ForwardsTo = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetForwardsTo(), "getter should return the property value") + }) + + t.Run("GetForwardsTo_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *URLForwarding + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetForwardsTo() // Should return zero value + }) + + t.Run("GetHost", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &URLForwarding{} + var expected string + obj.Host = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetHost(), "getter should return the property value") + }) + + t.Run("GetHost_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *URLForwarding + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetHost() // Should return zero value + }) + + t.Run("GetMeta", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &URLForwarding{} + var expected *string + obj.Meta = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetMeta(), "getter should return the property value") + }) + + t.Run("GetMeta_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &URLForwarding{} + obj.Meta = nil + + // Act & Assert + assert.Nil(t, obj.GetMeta(), "getter should return nil when property is nil") + }) + + t.Run("GetMeta_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *URLForwarding + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetMeta() // Should return zero value + }) + + t.Run("GetTitle", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &URLForwarding{} + var expected *string + obj.Title = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTitle(), "getter should return the property value") + }) + + t.Run("GetTitle_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &URLForwarding{} + obj.Title = nil + + // Act & Assert + assert.Nil(t, obj.GetTitle(), "getter should return nil when property is nil") + }) + + t.Run("GetTitle_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *URLForwarding + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTitle() // Should return zero value + }) + + t.Run("GetType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &URLForwarding{} + var expected URLForwardingType + obj.Type = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetType(), "getter should return the property value") + }) + + t.Run("GetType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *URLForwarding + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetType() // Should return zero value + }) + +} + +func TestSettersMarkExplicitURLForwarding(t *testing.T) { + t.Run("SetDomainName_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &URLForwarding{} + var fernTestValueDomainName *string + + // Act + obj.SetDomainName(fernTestValueDomainName) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetForwardsTo_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &URLForwarding{} + var fernTestValueForwardsTo string + + // Act + obj.SetForwardsTo(fernTestValueForwardsTo) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetHost_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &URLForwarding{} + var fernTestValueHost string + + // Act + obj.SetHost(fernTestValueHost) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetMeta_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &URLForwarding{} + var fernTestValueMeta *string + + // Act + obj.SetMeta(fernTestValueMeta) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetTitle_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &URLForwarding{} + var fernTestValueTitle *string + + // Act + obj.SetTitle(fernTestValueTitle) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip }) -} - -func TestSettersMarkExplicitUnsupportedMedia415(t *testing.T) { - t.Run("SetMessage_MarksExplicit", func(t *testing.T) { + t.Run("SetType_MarksExplicit", func(t *testing.T) { t.Parallel() // Arrange - obj := &UnsupportedMedia415{} - var fernTestValueMessage string + obj := &URLForwarding{} + var fernTestValueType URLForwardingType // Act - obj.SetMessage(fernTestValueMessage) + obj.SetType(fernTestValueType) // Assert - object with explicitly set field can be marshaled/unmarshaled bytes, err := json.Marshal(obj) @@ -11368,6 +12437,39 @@ func TestJSONMarshalingContactsRequest(t *testing.T) { }) } +func TestJSONMarshalingDomainExpiration(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DomainExpiration{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled DomainExpiration + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj DomainExpiration + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj DomainExpiration + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + func TestJSONMarshalingDomainLockStatusChange(t *testing.T) { t.Run("MarshalUnmarshal", func(t *testing.T) { t.Parallel() @@ -11500,6 +12602,39 @@ func TestJSONMarshalingDomainTransferInternalInStatusChange(t *testing.T) { }) } +func TestJSONMarshalingDomainTransferInternalOutStatusChange(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DomainTransferInternalOutStatusChange{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled DomainTransferInternalOutStatusChange + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj DomainTransferInternalOutStatusChange + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj DomainTransferInternalOutStatusChange + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + func TestJSONMarshalingDomainTransferOutStatusChange(t *testing.T) { t.Run("MarshalUnmarshal", func(t *testing.T) { t.Parallel() @@ -12094,6 +13229,39 @@ func TestJSONMarshalingTooManyRequestsErrorBody(t *testing.T) { }) } +func TestJSONMarshalingURLForwarding(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &URLForwarding{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled URLForwarding + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj URLForwarding + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj URLForwarding + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + func TestJSONMarshalingUnauthorizedErrorBody(t *testing.T) { t.Run("MarshalUnmarshal", func(t *testing.T) { t.Parallel() @@ -12467,6 +13635,22 @@ func TestStringContactsRequest(t *testing.T) { }) } +func TestStringDomainExpiration(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &DomainExpiration{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DomainExpiration + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + func TestStringDomainLockStatusChange(t *testing.T) { t.Run("StringMethod", func(t *testing.T) { t.Parallel() @@ -12531,6 +13715,22 @@ func TestStringDomainTransferInternalInStatusChange(t *testing.T) { }) } +func TestStringDomainTransferInternalOutStatusChange(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &DomainTransferInternalOutStatusChange{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DomainTransferInternalOutStatusChange + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + func TestStringDomainTransferOutStatusChange(t *testing.T) { t.Run("StringMethod", func(t *testing.T) { t.Parallel() @@ -12819,6 +14019,22 @@ func TestStringTooManyRequestsErrorBody(t *testing.T) { }) } +func TestStringURLForwarding(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &URLForwarding{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *URLForwarding + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + func TestStringUnauthorizedErrorBody(t *testing.T) { t.Run("StringMethod", func(t *testing.T) { t.Parallel() @@ -12943,6 +14159,28 @@ func TestEnumContactVerificationStatusChangeEventName(t *testing.T) { }) } +func TestEnumDomainExpirationEventName(t *testing.T) { + t.Run("NewFromString_domain_expiration", func(t *testing.T) { + t.Parallel() + val, err := NewDomainExpirationEventNameFromString("domain.expiration") + assert.NoError(t, err, "valid enum value should not return error") + assert.Equal(t, DomainExpirationEventName("domain.expiration"), val, "enum value should match expected wire value") + }) + + t.Run("NewFromString_Invalid", func(t *testing.T) { + _, err := NewDomainExpirationEventNameFromString("invalid_value_that_does_not_exist") + assert.Error(t, err) + }) + + t.Run("Ptr", func(t *testing.T) { + val, err := NewDomainExpirationEventNameFromString("domain.expiration") + assert.NoError(t, err) + ptr := val.Ptr() + assert.NotNil(t, ptr) + assert.Equal(t, val, *ptr) + }) +} + func TestEnumDomainLockStatusChangeAction(t *testing.T) { t.Run("NewFromString_added", func(t *testing.T) { t.Parallel() @@ -13131,6 +14369,50 @@ func TestEnumDomainTransferInternalInStatusChangeStatus(t *testing.T) { }) } +func TestEnumDomainTransferInternalOutStatusChangeEventName(t *testing.T) { + t.Run("NewFromString_domain_transfer_internal_out", func(t *testing.T) { + t.Parallel() + val, err := NewDomainTransferInternalOutStatusChangeEventNameFromString("domain.transfer.internal_out") + assert.NoError(t, err, "valid enum value should not return error") + assert.Equal(t, DomainTransferInternalOutStatusChangeEventName("domain.transfer.internal_out"), val, "enum value should match expected wire value") + }) + + t.Run("NewFromString_Invalid", func(t *testing.T) { + _, err := NewDomainTransferInternalOutStatusChangeEventNameFromString("invalid_value_that_does_not_exist") + assert.Error(t, err) + }) + + t.Run("Ptr", func(t *testing.T) { + val, err := NewDomainTransferInternalOutStatusChangeEventNameFromString("domain.transfer.internal_out") + assert.NoError(t, err) + ptr := val.Ptr() + assert.NotNil(t, ptr) + assert.Equal(t, val, *ptr) + }) +} + +func TestEnumDomainTransferInternalOutStatusChangeStatus(t *testing.T) { + t.Run("NewFromString_completed", func(t *testing.T) { + t.Parallel() + val, err := NewDomainTransferInternalOutStatusChangeStatusFromString("completed") + assert.NoError(t, err, "valid enum value should not return error") + assert.Equal(t, DomainTransferInternalOutStatusChangeStatus("completed"), val, "enum value should match expected wire value") + }) + + t.Run("NewFromString_Invalid", func(t *testing.T) { + _, err := NewDomainTransferInternalOutStatusChangeStatusFromString("invalid_value_that_does_not_exist") + assert.Error(t, err) + }) + + t.Run("Ptr", func(t *testing.T) { + val, err := NewDomainTransferInternalOutStatusChangeStatusFromString("completed") + assert.NoError(t, err) + ptr := val.Ptr() + assert.NotNil(t, ptr) + assert.Equal(t, val, *ptr) + }) +} + func TestEnumDomainTransferOutStatusChangeEventName(t *testing.T) { t.Run("NewFromString_domain_transfer_out_status_change", func(t *testing.T) { t.Parallel() @@ -13510,6 +14792,29 @@ func TestExtraPropertiesContactsRequest(t *testing.T) { }) } +func TestExtraPropertiesDomainExpiration(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &DomainExpiration{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DomainExpiration + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + func TestExtraPropertiesDomainLockStatusChange(t *testing.T) { t.Run("GetExtraProperties", func(t *testing.T) { t.Parallel() @@ -13602,6 +14907,29 @@ func TestExtraPropertiesDomainTransferInternalInStatusChange(t *testing.T) { }) } +func TestExtraPropertiesDomainTransferInternalOutStatusChange(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &DomainTransferInternalOutStatusChange{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DomainTransferInternalOutStatusChange + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + func TestExtraPropertiesDomainTransferOutStatusChange(t *testing.T) { t.Run("GetExtraProperties", func(t *testing.T) { t.Parallel() @@ -14016,6 +15344,29 @@ func TestExtraPropertiesTooManyRequestsErrorBody(t *testing.T) { }) } +func TestExtraPropertiesURLForwarding(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &URLForwarding{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *URLForwarding + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + func TestExtraPropertiesUnauthorizedErrorBody(t *testing.T) { t.Run("GetExtraProperties", func(t *testing.T) { t.Parallel() diff --git a/url_forwardings.go b/url_forwardings.go index cd94304..248e747 100644 --- a/url_forwardings.go +++ b/url_forwardings.go @@ -15,8 +15,8 @@ var ( type CreateURLForwardingRequest struct { // DomainName is the domain part of the hostname to forward. - DomainName string `json:"-" url:"-"` - Body CreateURLForwardingBody `json:"-" url:"-"` + DomainName string `json:"-" url:"-"` + Body *URLForwardingInput `json:"-" url:"-"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -37,7 +37,7 @@ func (c *CreateURLForwardingRequest) SetDomainName(domainName string) { } func (c *CreateURLForwardingRequest) UnmarshalJSON(data []byte) error { - var body CreateURLForwardingBody + body := new(URLForwardingInput) if err := json.Unmarshal(data, &body); err != nil { return err } @@ -294,8 +294,8 @@ type UpdateURLForwardingRequest struct { // DomainName is the domain part of the hostname to forward. DomainName string `json:"-" url:"-"` // The full hostname, including subdomain. - Host string `json:"-" url:"-"` - Body *UpdateURLForwardingBody `json:"-" url:"-"` + Host string `json:"-" url:"-"` + Body *URLForwardingInput `json:"-" url:"-"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -323,7 +323,7 @@ func (u *UpdateURLForwardingRequest) SetHost(host string) { } func (u *UpdateURLForwardingRequest) UnmarshalJSON(data []byte) error { - body := new(UpdateURLForwardingBody) + body := new(URLForwardingInput) if err := json.Unmarshal(data, &body); err != nil { return err } @@ -344,8 +344,8 @@ type UpdateURLForwardingByIDRequest struct { // DomainName is the domain that owns the URL forwarding entry. Must be owned by the authenticated account. DomainName string `json:"-" url:"-"` // ID is the server-assigned unique identifier for the URL forwarding record (returned in list responses). - ID int `json:"-" url:"-"` - Body *UpdateURLForwardingBody `json:"-" url:"-"` + ID int `json:"-" url:"-"` + Body *URLForwardingInput `json:"-" url:"-"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -373,7 +373,7 @@ func (u *UpdateURLForwardingByIDRequest) SetID(id int) { } func (u *UpdateURLForwardingByIDRequest) UnmarshalJSON(data []byte) error { - body := new(UpdateURLForwardingBody) + body := new(URLForwardingInput) if err := json.Unmarshal(data, &body); err != nil { return err } @@ -385,9 +385,6 @@ func (u *UpdateURLForwardingByIDRequest) MarshalJSON() ([]byte, error) { return json.Marshal(u.Body) } -// The request body for creating a new URL forwarding entry. -type CreateURLForwardingBody = *URLForwarding - // ListURLForwardingsResponse is the response for the ListURLForwardings function. var ( listURLForwardingsResponseFieldLastPage = big.NewInt(1 << 0) @@ -508,196 +505,16 @@ func (l *ListURLForwardingsResponse) String() string { return fmt.Sprintf("%#v", l) } -// The request body for updating an existing URL forwarding entry. +// Fields for creating or updating a URL forwarding entry. var ( - updateURLForwardingBodyFieldHost = big.NewInt(1 << 0) - updateURLForwardingBodyFieldDomainName = big.NewInt(1 << 1) - updateURLForwardingBodyFieldForwardsTo = big.NewInt(1 << 2) - updateURLForwardingBodyFieldMeta = big.NewInt(1 << 3) - updateURLForwardingBodyFieldTitle = big.NewInt(1 << 4) - updateURLForwardingBodyFieldType = big.NewInt(1 << 5) + uRLForwardingInputFieldForwardsTo = big.NewInt(1 << 0) + uRLForwardingInputFieldHost = big.NewInt(1 << 1) + uRLForwardingInputFieldMeta = big.NewInt(1 << 2) + uRLForwardingInputFieldTitle = big.NewInt(1 << 3) + uRLForwardingInputFieldType = big.NewInt(1 << 4) ) -type UpdateURLForwardingBody struct { - // The subdomain portion of the hostname that is being forwarded. - Host *string `json:"host,omitempty" url:"host,omitempty"` - // The domain name (without subdomains) that is being forwarded. - DomainName *string `json:"domainName,omitempty" url:"domainName,omitempty"` - // The destination URL to which this hostname will be forwarded. - ForwardsTo string `json:"forwardsTo" url:"forwardsTo"` - // Meta tags to include in the HTML page when using "masked" forwarding. - // Ignored for other forwarding types. - // Example: `` - Meta *string `json:"meta,omitempty" url:"meta,omitempty"` - // The title to be used for the HTML page when using "masked" forwarding. - // Ignored for other forwarding types. - Title *string `json:"title,omitempty" url:"title,omitempty"` - // The type of URL forwarding. Valid values: - // - `masked`: Retains the original domain in the address bar, preventing the user from seeing the actual destination URL. Sometimes called iframe forwarding. - // - `redirect`: Uses a standard HTTP redirect (301), which changes the address bar to the destination URL. - // - `302`: Uses a temporary HTTP redirect (302), which changes the address bar to the destination URL but indicates the resource is temporarily located elsewhere. - Type URLForwardingType `json:"type" url:"type"` - - // Private bitmask of fields set to an explicit value and therefore not to be omitted - explicitFields *big.Int `json:"-" url:"-"` - - extraProperties map[string]interface{} - rawJSON json.RawMessage -} - -func (u *UpdateURLForwardingBody) GetHost() *string { - if u == nil { - return nil - } - return u.Host -} - -func (u *UpdateURLForwardingBody) GetDomainName() *string { - if u == nil { - return nil - } - return u.DomainName -} - -func (u *UpdateURLForwardingBody) GetForwardsTo() string { - if u == nil { - return "" - } - return u.ForwardsTo -} - -func (u *UpdateURLForwardingBody) GetMeta() *string { - if u == nil { - return nil - } - return u.Meta -} - -func (u *UpdateURLForwardingBody) GetTitle() *string { - if u == nil { - return nil - } - return u.Title -} - -func (u *UpdateURLForwardingBody) GetType() URLForwardingType { - if u == nil { - return "" - } - return u.Type -} - -func (u *UpdateURLForwardingBody) GetExtraProperties() map[string]interface{} { - if u == nil { - return nil - } - return u.extraProperties -} - -func (u *UpdateURLForwardingBody) require(field *big.Int) { - if u.explicitFields == nil { - u.explicitFields = big.NewInt(0) - } - u.explicitFields.Or(u.explicitFields, field) -} - -// SetHost sets the Host field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (u *UpdateURLForwardingBody) SetHost(host *string) { - u.Host = host - u.require(updateURLForwardingBodyFieldHost) -} - -// SetDomainName sets the DomainName field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (u *UpdateURLForwardingBody) SetDomainName(domainName *string) { - u.DomainName = domainName - u.require(updateURLForwardingBodyFieldDomainName) -} - -// SetForwardsTo sets the ForwardsTo field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (u *UpdateURLForwardingBody) SetForwardsTo(forwardsTo string) { - u.ForwardsTo = forwardsTo - u.require(updateURLForwardingBodyFieldForwardsTo) -} - -// SetMeta sets the Meta field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (u *UpdateURLForwardingBody) SetMeta(meta *string) { - u.Meta = meta - u.require(updateURLForwardingBodyFieldMeta) -} - -// SetTitle sets the Title field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (u *UpdateURLForwardingBody) SetTitle(title *string) { - u.Title = title - u.require(updateURLForwardingBodyFieldTitle) -} - -// SetType sets the Type field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (u *UpdateURLForwardingBody) SetType(type_ URLForwardingType) { - u.Type = type_ - u.require(updateURLForwardingBodyFieldType) -} - -func (u *UpdateURLForwardingBody) UnmarshalJSON(data []byte) error { - type unmarshaler UpdateURLForwardingBody - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *u = UpdateURLForwardingBody(value) - extraProperties, err := internal.ExtractExtraProperties(data, *u) - if err != nil { - return err - } - u.extraProperties = extraProperties - u.rawJSON = json.RawMessage(data) - return nil -} - -func (u *UpdateURLForwardingBody) MarshalJSON() ([]byte, error) { - type embed UpdateURLForwardingBody - var marshaler = struct { - embed - }{ - embed: embed(*u), - } - explicitMarshaler := internal.HandleExplicitFields(marshaler, u.explicitFields) - return json.Marshal(explicitMarshaler) -} - -func (u *UpdateURLForwardingBody) String() string { - if u == nil { - return "" - } - if len(u.rawJSON) > 0 { - if value, err := internal.StringifyJSON(u.rawJSON); err == nil { - return value - } - } - if value, err := internal.StringifyJSON(u); err == nil { - return value - } - return fmt.Sprintf("%#v", u) -} - -// URLForwarding represents a URL forwarding entry, allowing a domain to redirect to another URL using different forwarding methods. -var ( - uRLForwardingFieldDomainName = big.NewInt(1 << 0) - uRLForwardingFieldForwardsTo = big.NewInt(1 << 1) - uRLForwardingFieldHost = big.NewInt(1 << 2) - uRLForwardingFieldMeta = big.NewInt(1 << 3) - uRLForwardingFieldTitle = big.NewInt(1 << 4) - uRLForwardingFieldType = big.NewInt(1 << 5) -) - -type URLForwarding struct { - // The domain name (without subdomains) that is being forwarded. - DomainName *string `json:"domainName,omitempty" url:"domainName,omitempty"` +type URLForwardingInput struct { // The destination URL to which this hostname will be forwarded. ForwardsTo string `json:"forwardsTo" url:"forwardsTo"` // The subdomain portion of the hostname that is being forwarded. @@ -713,7 +530,7 @@ type URLForwarding struct { // - `masked`: Retains the original domain in the address bar, preventing the user from seeing the actual destination URL. Sometimes called iframe forwarding. // - `redirect`: Uses a standard HTTP redirect (301), which changes the address bar to the destination URL. // - `302`: Uses a temporary HTTP redirect (302), which changes the address bar to the destination URL but indicates the resource is temporarily located elsewhere. - Type URLForwardingType `json:"type" url:"type"` + Type URLForwardingInputType `json:"type" url:"type"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -722,111 +539,97 @@ type URLForwarding struct { rawJSON json.RawMessage } -func (u *URLForwarding) GetDomainName() *string { - if u == nil { - return nil - } - return u.DomainName -} - -func (u *URLForwarding) GetForwardsTo() string { +func (u *URLForwardingInput) GetForwardsTo() string { if u == nil { return "" } return u.ForwardsTo } -func (u *URLForwarding) GetHost() string { +func (u *URLForwardingInput) GetHost() string { if u == nil { return "" } return u.Host } -func (u *URLForwarding) GetMeta() *string { +func (u *URLForwardingInput) GetMeta() *string { if u == nil { return nil } return u.Meta } -func (u *URLForwarding) GetTitle() *string { +func (u *URLForwardingInput) GetTitle() *string { if u == nil { return nil } return u.Title } -func (u *URLForwarding) GetType() URLForwardingType { +func (u *URLForwardingInput) GetType() URLForwardingInputType { if u == nil { return "" } return u.Type } -func (u *URLForwarding) GetExtraProperties() map[string]interface{} { +func (u *URLForwardingInput) GetExtraProperties() map[string]interface{} { if u == nil { return nil } return u.extraProperties } -func (u *URLForwarding) require(field *big.Int) { +func (u *URLForwardingInput) require(field *big.Int) { if u.explicitFields == nil { u.explicitFields = big.NewInt(0) } u.explicitFields.Or(u.explicitFields, field) } -// SetDomainName sets the DomainName field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (u *URLForwarding) SetDomainName(domainName *string) { - u.DomainName = domainName - u.require(uRLForwardingFieldDomainName) -} - // SetForwardsTo sets the ForwardsTo field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (u *URLForwarding) SetForwardsTo(forwardsTo string) { +func (u *URLForwardingInput) SetForwardsTo(forwardsTo string) { u.ForwardsTo = forwardsTo - u.require(uRLForwardingFieldForwardsTo) + u.require(uRLForwardingInputFieldForwardsTo) } // SetHost sets the Host field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (u *URLForwarding) SetHost(host string) { +func (u *URLForwardingInput) SetHost(host string) { u.Host = host - u.require(uRLForwardingFieldHost) + u.require(uRLForwardingInputFieldHost) } // SetMeta sets the Meta field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (u *URLForwarding) SetMeta(meta *string) { +func (u *URLForwardingInput) SetMeta(meta *string) { u.Meta = meta - u.require(uRLForwardingFieldMeta) + u.require(uRLForwardingInputFieldMeta) } // SetTitle sets the Title field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (u *URLForwarding) SetTitle(title *string) { +func (u *URLForwardingInput) SetTitle(title *string) { u.Title = title - u.require(uRLForwardingFieldTitle) + u.require(uRLForwardingInputFieldTitle) } // SetType sets the Type field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (u *URLForwarding) SetType(type_ URLForwardingType) { +func (u *URLForwardingInput) SetType(type_ URLForwardingInputType) { u.Type = type_ - u.require(uRLForwardingFieldType) + u.require(uRLForwardingInputFieldType) } -func (u *URLForwarding) UnmarshalJSON(data []byte) error { - type unmarshaler URLForwarding +func (u *URLForwardingInput) UnmarshalJSON(data []byte) error { + type unmarshaler URLForwardingInput var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *u = URLForwarding(value) + *u = URLForwardingInput(value) extraProperties, err := internal.ExtractExtraProperties(data, *u) if err != nil { return err @@ -836,8 +639,8 @@ func (u *URLForwarding) UnmarshalJSON(data []byte) error { return nil } -func (u *URLForwarding) MarshalJSON() ([]byte, error) { - type embed URLForwarding +func (u *URLForwardingInput) MarshalJSON() ([]byte, error) { + type embed URLForwardingInput var marshaler = struct { embed }{ @@ -847,7 +650,7 @@ func (u *URLForwarding) MarshalJSON() ([]byte, error) { return json.Marshal(explicitMarshaler) } -func (u *URLForwarding) String() string { +func (u *URLForwardingInput) String() string { if u == nil { return "" } @@ -862,6 +665,35 @@ func (u *URLForwarding) String() string { return fmt.Sprintf("%#v", u) } +// The type of URL forwarding. Valid values: +// - `masked`: Retains the original domain in the address bar, preventing the user from seeing the actual destination URL. Sometimes called iframe forwarding. +// - `redirect`: Uses a standard HTTP redirect (301), which changes the address bar to the destination URL. +// - `302`: Uses a temporary HTTP redirect (302), which changes the address bar to the destination URL but indicates the resource is temporarily located elsewhere. +type URLForwardingInputType string + +const ( + URLForwardingInputTypeMasked URLForwardingInputType = "masked" + URLForwardingInputTypeRedirect URLForwardingInputType = "redirect" + URLForwardingInputTypeThreeHundredTwo URLForwardingInputType = "302" +) + +func NewURLForwardingInputTypeFromString(s string) (URLForwardingInputType, error) { + switch s { + case "masked": + return URLForwardingInputTypeMasked, nil + case "redirect": + return URLForwardingInputTypeRedirect, nil + case "302": + return URLForwardingInputTypeThreeHundredTwo, nil + } + var t URLForwardingInputType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (u URLForwardingInputType) Ptr() *URLForwardingInputType { + return &u +} + // URLForwarding represents a URL forwarding entry response, allowing a domain to redirect to another URL using different forwarding methods. var ( uRLForwardingResponseFieldID = big.NewInt(1 << 0) diff --git a/url_forwardings_test.go b/url_forwardings_test.go index cbbee32..f9ef17d 100644 --- a/url_forwardings_test.go +++ b/url_forwardings_test.go @@ -1029,438 +1029,9 @@ func TestSettersMarkExplicitListURLForwardingsResponse(t *testing.T) { } -func TestSettersUpdateURLForwardingBody(t *testing.T) { - t.Run("SetHost", func(t *testing.T) { - obj := &UpdateURLForwardingBody{} - var fernTestValueHost *string - obj.SetHost(fernTestValueHost) - assert.Equal(t, fernTestValueHost, obj.Host) - assert.NotNil(t, obj.explicitFields) - }) - - t.Run("SetDomainName", func(t *testing.T) { - obj := &UpdateURLForwardingBody{} - var fernTestValueDomainName *string - obj.SetDomainName(fernTestValueDomainName) - assert.Equal(t, fernTestValueDomainName, obj.DomainName) - assert.NotNil(t, obj.explicitFields) - }) - - t.Run("SetForwardsTo", func(t *testing.T) { - obj := &UpdateURLForwardingBody{} - var fernTestValueForwardsTo string - obj.SetForwardsTo(fernTestValueForwardsTo) - assert.Equal(t, fernTestValueForwardsTo, obj.ForwardsTo) - assert.NotNil(t, obj.explicitFields) - }) - - t.Run("SetMeta", func(t *testing.T) { - obj := &UpdateURLForwardingBody{} - var fernTestValueMeta *string - obj.SetMeta(fernTestValueMeta) - assert.Equal(t, fernTestValueMeta, obj.Meta) - assert.NotNil(t, obj.explicitFields) - }) - - t.Run("SetTitle", func(t *testing.T) { - obj := &UpdateURLForwardingBody{} - var fernTestValueTitle *string - obj.SetTitle(fernTestValueTitle) - assert.Equal(t, fernTestValueTitle, obj.Title) - assert.NotNil(t, obj.explicitFields) - }) - - t.Run("SetType", func(t *testing.T) { - obj := &UpdateURLForwardingBody{} - var fernTestValueType URLForwardingType - obj.SetType(fernTestValueType) - assert.Equal(t, fernTestValueType, obj.Type) - assert.NotNil(t, obj.explicitFields) - }) - -} - -func TestGettersUpdateURLForwardingBody(t *testing.T) { - t.Run("GetHost", func(t *testing.T) { - t.Parallel() - // Arrange - obj := &UpdateURLForwardingBody{} - var expected *string - obj.Host = expected - - // Act & Assert - assert.Equal(t, expected, obj.GetHost(), "getter should return the property value") - }) - - t.Run("GetHost_NilValue", func(t *testing.T) { - t.Parallel() - // Arrange - obj := &UpdateURLForwardingBody{} - obj.Host = nil - - // Act & Assert - assert.Nil(t, obj.GetHost(), "getter should return nil when property is nil") - }) - - t.Run("GetHost_NilReceiver", func(t *testing.T) { - t.Parallel() - var obj *UpdateURLForwardingBody - // Should not panic - getters should handle nil receiver gracefully - defer func() { - if r := recover(); r != nil { - t.Errorf("Getter panicked on nil receiver: %v", r) - } - }() - _ = obj.GetHost() // Should return zero value - }) - - t.Run("GetDomainName", func(t *testing.T) { - t.Parallel() - // Arrange - obj := &UpdateURLForwardingBody{} - var expected *string - obj.DomainName = expected - - // Act & Assert - assert.Equal(t, expected, obj.GetDomainName(), "getter should return the property value") - }) - - t.Run("GetDomainName_NilValue", func(t *testing.T) { - t.Parallel() - // Arrange - obj := &UpdateURLForwardingBody{} - obj.DomainName = nil - - // Act & Assert - assert.Nil(t, obj.GetDomainName(), "getter should return nil when property is nil") - }) - - t.Run("GetDomainName_NilReceiver", func(t *testing.T) { - t.Parallel() - var obj *UpdateURLForwardingBody - // Should not panic - getters should handle nil receiver gracefully - defer func() { - if r := recover(); r != nil { - t.Errorf("Getter panicked on nil receiver: %v", r) - } - }() - _ = obj.GetDomainName() // Should return zero value - }) - - t.Run("GetForwardsTo", func(t *testing.T) { - t.Parallel() - // Arrange - obj := &UpdateURLForwardingBody{} - var expected string - obj.ForwardsTo = expected - - // Act & Assert - assert.Equal(t, expected, obj.GetForwardsTo(), "getter should return the property value") - }) - - t.Run("GetForwardsTo_NilReceiver", func(t *testing.T) { - t.Parallel() - var obj *UpdateURLForwardingBody - // Should not panic - getters should handle nil receiver gracefully - defer func() { - if r := recover(); r != nil { - t.Errorf("Getter panicked on nil receiver: %v", r) - } - }() - _ = obj.GetForwardsTo() // Should return zero value - }) - - t.Run("GetMeta", func(t *testing.T) { - t.Parallel() - // Arrange - obj := &UpdateURLForwardingBody{} - var expected *string - obj.Meta = expected - - // Act & Assert - assert.Equal(t, expected, obj.GetMeta(), "getter should return the property value") - }) - - t.Run("GetMeta_NilValue", func(t *testing.T) { - t.Parallel() - // Arrange - obj := &UpdateURLForwardingBody{} - obj.Meta = nil - - // Act & Assert - assert.Nil(t, obj.GetMeta(), "getter should return nil when property is nil") - }) - - t.Run("GetMeta_NilReceiver", func(t *testing.T) { - t.Parallel() - var obj *UpdateURLForwardingBody - // Should not panic - getters should handle nil receiver gracefully - defer func() { - if r := recover(); r != nil { - t.Errorf("Getter panicked on nil receiver: %v", r) - } - }() - _ = obj.GetMeta() // Should return zero value - }) - - t.Run("GetTitle", func(t *testing.T) { - t.Parallel() - // Arrange - obj := &UpdateURLForwardingBody{} - var expected *string - obj.Title = expected - - // Act & Assert - assert.Equal(t, expected, obj.GetTitle(), "getter should return the property value") - }) - - t.Run("GetTitle_NilValue", func(t *testing.T) { - t.Parallel() - // Arrange - obj := &UpdateURLForwardingBody{} - obj.Title = nil - - // Act & Assert - assert.Nil(t, obj.GetTitle(), "getter should return nil when property is nil") - }) - - t.Run("GetTitle_NilReceiver", func(t *testing.T) { - t.Parallel() - var obj *UpdateURLForwardingBody - // Should not panic - getters should handle nil receiver gracefully - defer func() { - if r := recover(); r != nil { - t.Errorf("Getter panicked on nil receiver: %v", r) - } - }() - _ = obj.GetTitle() // Should return zero value - }) - - t.Run("GetType", func(t *testing.T) { - t.Parallel() - // Arrange - obj := &UpdateURLForwardingBody{} - var expected URLForwardingType - obj.Type = expected - - // Act & Assert - assert.Equal(t, expected, obj.GetType(), "getter should return the property value") - }) - - t.Run("GetType_NilReceiver", func(t *testing.T) { - t.Parallel() - var obj *UpdateURLForwardingBody - // Should not panic - getters should handle nil receiver gracefully - defer func() { - if r := recover(); r != nil { - t.Errorf("Getter panicked on nil receiver: %v", r) - } - }() - _ = obj.GetType() // Should return zero value - }) - -} - -func TestSettersMarkExplicitUpdateURLForwardingBody(t *testing.T) { - t.Run("SetHost_MarksExplicit", func(t *testing.T) { - t.Parallel() - // Arrange - obj := &UpdateURLForwardingBody{} - var fernTestValueHost *string - - // Act - obj.SetHost(fernTestValueHost) - - // Assert - object with explicitly set field can be marshaled/unmarshaled - bytes, err := json.Marshal(obj) - require.NoError(t, err, "marshaling should succeed for test setup") - - // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value - // Detect if marshaled JSON is an object or primitive to use correct unmarshal target - if len(bytes) > 0 && bytes[0] == '{' { - // JSON object - unmarshal into map - var unmarshaled map[string]interface{} - err = json.Unmarshal(bytes, &unmarshaled) - require.NoError(t, err, "unmarshaling should succeed for test verification") - } else { - // JSON primitive (string, number, boolean, null) - unmarshal into interface{} - var unmarshaled interface{} - err = json.Unmarshal(bytes, &unmarshaled) - require.NoError(t, err, "unmarshaling should succeed for test verification") - } - - // Note: This does not explicitly assert the presence of a specific JSON field - // It verifies that setting a field via setter allows successful JSON round-trip - }) - - t.Run("SetDomainName_MarksExplicit", func(t *testing.T) { - t.Parallel() - // Arrange - obj := &UpdateURLForwardingBody{} - var fernTestValueDomainName *string - - // Act - obj.SetDomainName(fernTestValueDomainName) - - // Assert - object with explicitly set field can be marshaled/unmarshaled - bytes, err := json.Marshal(obj) - require.NoError(t, err, "marshaling should succeed for test setup") - - // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value - // Detect if marshaled JSON is an object or primitive to use correct unmarshal target - if len(bytes) > 0 && bytes[0] == '{' { - // JSON object - unmarshal into map - var unmarshaled map[string]interface{} - err = json.Unmarshal(bytes, &unmarshaled) - require.NoError(t, err, "unmarshaling should succeed for test verification") - } else { - // JSON primitive (string, number, boolean, null) - unmarshal into interface{} - var unmarshaled interface{} - err = json.Unmarshal(bytes, &unmarshaled) - require.NoError(t, err, "unmarshaling should succeed for test verification") - } - - // Note: This does not explicitly assert the presence of a specific JSON field - // It verifies that setting a field via setter allows successful JSON round-trip - }) - - t.Run("SetForwardsTo_MarksExplicit", func(t *testing.T) { - t.Parallel() - // Arrange - obj := &UpdateURLForwardingBody{} - var fernTestValueForwardsTo string - - // Act - obj.SetForwardsTo(fernTestValueForwardsTo) - - // Assert - object with explicitly set field can be marshaled/unmarshaled - bytes, err := json.Marshal(obj) - require.NoError(t, err, "marshaling should succeed for test setup") - - // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value - // Detect if marshaled JSON is an object or primitive to use correct unmarshal target - if len(bytes) > 0 && bytes[0] == '{' { - // JSON object - unmarshal into map - var unmarshaled map[string]interface{} - err = json.Unmarshal(bytes, &unmarshaled) - require.NoError(t, err, "unmarshaling should succeed for test verification") - } else { - // JSON primitive (string, number, boolean, null) - unmarshal into interface{} - var unmarshaled interface{} - err = json.Unmarshal(bytes, &unmarshaled) - require.NoError(t, err, "unmarshaling should succeed for test verification") - } - - // Note: This does not explicitly assert the presence of a specific JSON field - // It verifies that setting a field via setter allows successful JSON round-trip - }) - - t.Run("SetMeta_MarksExplicit", func(t *testing.T) { - t.Parallel() - // Arrange - obj := &UpdateURLForwardingBody{} - var fernTestValueMeta *string - - // Act - obj.SetMeta(fernTestValueMeta) - - // Assert - object with explicitly set field can be marshaled/unmarshaled - bytes, err := json.Marshal(obj) - require.NoError(t, err, "marshaling should succeed for test setup") - - // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value - // Detect if marshaled JSON is an object or primitive to use correct unmarshal target - if len(bytes) > 0 && bytes[0] == '{' { - // JSON object - unmarshal into map - var unmarshaled map[string]interface{} - err = json.Unmarshal(bytes, &unmarshaled) - require.NoError(t, err, "unmarshaling should succeed for test verification") - } else { - // JSON primitive (string, number, boolean, null) - unmarshal into interface{} - var unmarshaled interface{} - err = json.Unmarshal(bytes, &unmarshaled) - require.NoError(t, err, "unmarshaling should succeed for test verification") - } - - // Note: This does not explicitly assert the presence of a specific JSON field - // It verifies that setting a field via setter allows successful JSON round-trip - }) - - t.Run("SetTitle_MarksExplicit", func(t *testing.T) { - t.Parallel() - // Arrange - obj := &UpdateURLForwardingBody{} - var fernTestValueTitle *string - - // Act - obj.SetTitle(fernTestValueTitle) - - // Assert - object with explicitly set field can be marshaled/unmarshaled - bytes, err := json.Marshal(obj) - require.NoError(t, err, "marshaling should succeed for test setup") - - // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value - // Detect if marshaled JSON is an object or primitive to use correct unmarshal target - if len(bytes) > 0 && bytes[0] == '{' { - // JSON object - unmarshal into map - var unmarshaled map[string]interface{} - err = json.Unmarshal(bytes, &unmarshaled) - require.NoError(t, err, "unmarshaling should succeed for test verification") - } else { - // JSON primitive (string, number, boolean, null) - unmarshal into interface{} - var unmarshaled interface{} - err = json.Unmarshal(bytes, &unmarshaled) - require.NoError(t, err, "unmarshaling should succeed for test verification") - } - - // Note: This does not explicitly assert the presence of a specific JSON field - // It verifies that setting a field via setter allows successful JSON round-trip - }) - - t.Run("SetType_MarksExplicit", func(t *testing.T) { - t.Parallel() - // Arrange - obj := &UpdateURLForwardingBody{} - var fernTestValueType URLForwardingType - - // Act - obj.SetType(fernTestValueType) - - // Assert - object with explicitly set field can be marshaled/unmarshaled - bytes, err := json.Marshal(obj) - require.NoError(t, err, "marshaling should succeed for test setup") - - // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value - // Detect if marshaled JSON is an object or primitive to use correct unmarshal target - if len(bytes) > 0 && bytes[0] == '{' { - // JSON object - unmarshal into map - var unmarshaled map[string]interface{} - err = json.Unmarshal(bytes, &unmarshaled) - require.NoError(t, err, "unmarshaling should succeed for test verification") - } else { - // JSON primitive (string, number, boolean, null) - unmarshal into interface{} - var unmarshaled interface{} - err = json.Unmarshal(bytes, &unmarshaled) - require.NoError(t, err, "unmarshaling should succeed for test verification") - } - - // Note: This does not explicitly assert the presence of a specific JSON field - // It verifies that setting a field via setter allows successful JSON round-trip - }) - -} - -func TestSettersURLForwarding(t *testing.T) { - t.Run("SetDomainName", func(t *testing.T) { - obj := &URLForwarding{} - var fernTestValueDomainName *string - obj.SetDomainName(fernTestValueDomainName) - assert.Equal(t, fernTestValueDomainName, obj.DomainName) - assert.NotNil(t, obj.explicitFields) - }) - +func TestSettersURLForwardingInput(t *testing.T) { t.Run("SetForwardsTo", func(t *testing.T) { - obj := &URLForwarding{} + obj := &URLForwardingInput{} var fernTestValueForwardsTo string obj.SetForwardsTo(fernTestValueForwardsTo) assert.Equal(t, fernTestValueForwardsTo, obj.ForwardsTo) @@ -1468,7 +1039,7 @@ func TestSettersURLForwarding(t *testing.T) { }) t.Run("SetHost", func(t *testing.T) { - obj := &URLForwarding{} + obj := &URLForwardingInput{} var fernTestValueHost string obj.SetHost(fernTestValueHost) assert.Equal(t, fernTestValueHost, obj.Host) @@ -1476,7 +1047,7 @@ func TestSettersURLForwarding(t *testing.T) { }) t.Run("SetMeta", func(t *testing.T) { - obj := &URLForwarding{} + obj := &URLForwardingInput{} var fernTestValueMeta *string obj.SetMeta(fernTestValueMeta) assert.Equal(t, fernTestValueMeta, obj.Meta) @@ -1484,7 +1055,7 @@ func TestSettersURLForwarding(t *testing.T) { }) t.Run("SetTitle", func(t *testing.T) { - obj := &URLForwarding{} + obj := &URLForwardingInput{} var fernTestValueTitle *string obj.SetTitle(fernTestValueTitle) assert.Equal(t, fernTestValueTitle, obj.Title) @@ -1492,8 +1063,8 @@ func TestSettersURLForwarding(t *testing.T) { }) t.Run("SetType", func(t *testing.T) { - obj := &URLForwarding{} - var fernTestValueType URLForwardingType + obj := &URLForwardingInput{} + var fernTestValueType URLForwardingInputType obj.SetType(fernTestValueType) assert.Equal(t, fernTestValueType, obj.Type) assert.NotNil(t, obj.explicitFields) @@ -1501,44 +1072,11 @@ func TestSettersURLForwarding(t *testing.T) { } -func TestGettersURLForwarding(t *testing.T) { - t.Run("GetDomainName", func(t *testing.T) { - t.Parallel() - // Arrange - obj := &URLForwarding{} - var expected *string - obj.DomainName = expected - - // Act & Assert - assert.Equal(t, expected, obj.GetDomainName(), "getter should return the property value") - }) - - t.Run("GetDomainName_NilValue", func(t *testing.T) { - t.Parallel() - // Arrange - obj := &URLForwarding{} - obj.DomainName = nil - - // Act & Assert - assert.Nil(t, obj.GetDomainName(), "getter should return nil when property is nil") - }) - - t.Run("GetDomainName_NilReceiver", func(t *testing.T) { - t.Parallel() - var obj *URLForwarding - // Should not panic - getters should handle nil receiver gracefully - defer func() { - if r := recover(); r != nil { - t.Errorf("Getter panicked on nil receiver: %v", r) - } - }() - _ = obj.GetDomainName() // Should return zero value - }) - +func TestGettersURLForwardingInput(t *testing.T) { t.Run("GetForwardsTo", func(t *testing.T) { t.Parallel() // Arrange - obj := &URLForwarding{} + obj := &URLForwardingInput{} var expected string obj.ForwardsTo = expected @@ -1548,7 +1086,7 @@ func TestGettersURLForwarding(t *testing.T) { t.Run("GetForwardsTo_NilReceiver", func(t *testing.T) { t.Parallel() - var obj *URLForwarding + var obj *URLForwardingInput // Should not panic - getters should handle nil receiver gracefully defer func() { if r := recover(); r != nil { @@ -1561,7 +1099,7 @@ func TestGettersURLForwarding(t *testing.T) { t.Run("GetHost", func(t *testing.T) { t.Parallel() // Arrange - obj := &URLForwarding{} + obj := &URLForwardingInput{} var expected string obj.Host = expected @@ -1571,7 +1109,7 @@ func TestGettersURLForwarding(t *testing.T) { t.Run("GetHost_NilReceiver", func(t *testing.T) { t.Parallel() - var obj *URLForwarding + var obj *URLForwardingInput // Should not panic - getters should handle nil receiver gracefully defer func() { if r := recover(); r != nil { @@ -1584,7 +1122,7 @@ func TestGettersURLForwarding(t *testing.T) { t.Run("GetMeta", func(t *testing.T) { t.Parallel() // Arrange - obj := &URLForwarding{} + obj := &URLForwardingInput{} var expected *string obj.Meta = expected @@ -1595,7 +1133,7 @@ func TestGettersURLForwarding(t *testing.T) { t.Run("GetMeta_NilValue", func(t *testing.T) { t.Parallel() // Arrange - obj := &URLForwarding{} + obj := &URLForwardingInput{} obj.Meta = nil // Act & Assert @@ -1604,7 +1142,7 @@ func TestGettersURLForwarding(t *testing.T) { t.Run("GetMeta_NilReceiver", func(t *testing.T) { t.Parallel() - var obj *URLForwarding + var obj *URLForwardingInput // Should not panic - getters should handle nil receiver gracefully defer func() { if r := recover(); r != nil { @@ -1617,7 +1155,7 @@ func TestGettersURLForwarding(t *testing.T) { t.Run("GetTitle", func(t *testing.T) { t.Parallel() // Arrange - obj := &URLForwarding{} + obj := &URLForwardingInput{} var expected *string obj.Title = expected @@ -1628,7 +1166,7 @@ func TestGettersURLForwarding(t *testing.T) { t.Run("GetTitle_NilValue", func(t *testing.T) { t.Parallel() // Arrange - obj := &URLForwarding{} + obj := &URLForwardingInput{} obj.Title = nil // Act & Assert @@ -1637,7 +1175,7 @@ func TestGettersURLForwarding(t *testing.T) { t.Run("GetTitle_NilReceiver", func(t *testing.T) { t.Parallel() - var obj *URLForwarding + var obj *URLForwardingInput // Should not panic - getters should handle nil receiver gracefully defer func() { if r := recover(); r != nil { @@ -1650,8 +1188,8 @@ func TestGettersURLForwarding(t *testing.T) { t.Run("GetType", func(t *testing.T) { t.Parallel() // Arrange - obj := &URLForwarding{} - var expected URLForwardingType + obj := &URLForwardingInput{} + var expected URLForwardingInputType obj.Type = expected // Act & Assert @@ -1660,7 +1198,7 @@ func TestGettersURLForwarding(t *testing.T) { t.Run("GetType_NilReceiver", func(t *testing.T) { t.Parallel() - var obj *URLForwarding + var obj *URLForwardingInput // Should not panic - getters should handle nil receiver gracefully defer func() { if r := recover(); r != nil { @@ -1672,42 +1210,11 @@ func TestGettersURLForwarding(t *testing.T) { } -func TestSettersMarkExplicitURLForwarding(t *testing.T) { - t.Run("SetDomainName_MarksExplicit", func(t *testing.T) { - t.Parallel() - // Arrange - obj := &URLForwarding{} - var fernTestValueDomainName *string - - // Act - obj.SetDomainName(fernTestValueDomainName) - - // Assert - object with explicitly set field can be marshaled/unmarshaled - bytes, err := json.Marshal(obj) - require.NoError(t, err, "marshaling should succeed for test setup") - - // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value - // Detect if marshaled JSON is an object or primitive to use correct unmarshal target - if len(bytes) > 0 && bytes[0] == '{' { - // JSON object - unmarshal into map - var unmarshaled map[string]interface{} - err = json.Unmarshal(bytes, &unmarshaled) - require.NoError(t, err, "unmarshaling should succeed for test verification") - } else { - // JSON primitive (string, number, boolean, null) - unmarshal into interface{} - var unmarshaled interface{} - err = json.Unmarshal(bytes, &unmarshaled) - require.NoError(t, err, "unmarshaling should succeed for test verification") - } - - // Note: This does not explicitly assert the presence of a specific JSON field - // It verifies that setting a field via setter allows successful JSON round-trip - }) - +func TestSettersMarkExplicitURLForwardingInput(t *testing.T) { t.Run("SetForwardsTo_MarksExplicit", func(t *testing.T) { t.Parallel() // Arrange - obj := &URLForwarding{} + obj := &URLForwardingInput{} var fernTestValueForwardsTo string // Act @@ -1738,7 +1245,7 @@ func TestSettersMarkExplicitURLForwarding(t *testing.T) { t.Run("SetHost_MarksExplicit", func(t *testing.T) { t.Parallel() // Arrange - obj := &URLForwarding{} + obj := &URLForwardingInput{} var fernTestValueHost string // Act @@ -1769,7 +1276,7 @@ func TestSettersMarkExplicitURLForwarding(t *testing.T) { t.Run("SetMeta_MarksExplicit", func(t *testing.T) { t.Parallel() // Arrange - obj := &URLForwarding{} + obj := &URLForwardingInput{} var fernTestValueMeta *string // Act @@ -1800,7 +1307,7 @@ func TestSettersMarkExplicitURLForwarding(t *testing.T) { t.Run("SetTitle_MarksExplicit", func(t *testing.T) { t.Parallel() // Arrange - obj := &URLForwarding{} + obj := &URLForwardingInput{} var fernTestValueTitle *string // Act @@ -1831,8 +1338,8 @@ func TestSettersMarkExplicitURLForwarding(t *testing.T) { t.Run("SetType_MarksExplicit", func(t *testing.T) { t.Parallel() // Arrange - obj := &URLForwarding{} - var fernTestValueType URLForwardingType + obj := &URLForwardingInput{} + var fernTestValueType URLForwardingInputType // Act obj.SetType(fernTestValueType) @@ -2387,11 +1894,11 @@ func TestJSONMarshalingListURLForwardingsResponse(t *testing.T) { }) } -func TestJSONMarshalingURLForwarding(t *testing.T) { +func TestJSONMarshalingURLForwardingInput(t *testing.T) { t.Run("MarshalUnmarshal", func(t *testing.T) { t.Parallel() // Arrange - obj := &URLForwarding{} + obj := &URLForwardingInput{} // Act - Marshal to JSON data, err := json.Marshal(obj) @@ -2400,21 +1907,21 @@ func TestJSONMarshalingURLForwarding(t *testing.T) { assert.NotEmpty(t, data, "marshaled data should not be empty") // Unmarshal back and verify round-trip - var unmarshaled URLForwarding + var unmarshaled URLForwardingInput err = json.Unmarshal(data, &unmarshaled) assert.NoError(t, err, "round-trip unmarshal should succeed") }) t.Run("UnmarshalInvalidJSON", func(t *testing.T) { t.Parallel() - var obj URLForwarding + var obj URLForwardingInput err := json.Unmarshal([]byte(`{invalid json}`), &obj) assert.Error(t, err, "unmarshaling invalid JSON should return an error") }) t.Run("UnmarshalEmptyObject", func(t *testing.T) { t.Parallel() - var obj URLForwarding + var obj URLForwardingInput err := json.Unmarshal([]byte(`{}`), &obj) assert.NoError(t, err, "unmarshaling empty object should succeed") }) @@ -2453,39 +1960,6 @@ func TestJSONMarshalingURLForwardingResponse(t *testing.T) { }) } -func TestJSONMarshalingUpdateURLForwardingBody(t *testing.T) { - t.Run("MarshalUnmarshal", func(t *testing.T) { - t.Parallel() - // Arrange - obj := &UpdateURLForwardingBody{} - - // Act - Marshal to JSON - data, err := json.Marshal(obj) - require.NoError(t, err, "marshaling should succeed") - assert.NotNil(t, data, "marshaled data should not be nil") - assert.NotEmpty(t, data, "marshaled data should not be empty") - - // Unmarshal back and verify round-trip - var unmarshaled UpdateURLForwardingBody - err = json.Unmarshal(data, &unmarshaled) - assert.NoError(t, err, "round-trip unmarshal should succeed") - }) - - t.Run("UnmarshalInvalidJSON", func(t *testing.T) { - t.Parallel() - var obj UpdateURLForwardingBody - err := json.Unmarshal([]byte(`{invalid json}`), &obj) - assert.Error(t, err, "unmarshaling invalid JSON should return an error") - }) - - t.Run("UnmarshalEmptyObject", func(t *testing.T) { - t.Parallel() - var obj UpdateURLForwardingBody - err := json.Unmarshal([]byte(`{}`), &obj) - assert.NoError(t, err, "unmarshaling empty object should succeed") - }) -} - func TestStringListURLForwardingsResponse(t *testing.T) { t.Run("StringMethod", func(t *testing.T) { t.Parallel() @@ -2502,17 +1976,17 @@ func TestStringListURLForwardingsResponse(t *testing.T) { }) } -func TestStringURLForwarding(t *testing.T) { +func TestStringURLForwardingInput(t *testing.T) { t.Run("StringMethod", func(t *testing.T) { t.Parallel() - obj := &URLForwarding{} + obj := &URLForwardingInput{} result := obj.String() assert.NotEmpty(t, result, "String() should return a non-empty representation") }) t.Run("StringMethod_NilReceiver", func(t *testing.T) { t.Parallel() - var obj *URLForwarding + var obj *URLForwardingInput result := obj.String() assert.Equal(t, "", result, "String() should return for nil receiver") }) @@ -2534,19 +2008,39 @@ func TestStringURLForwardingResponse(t *testing.T) { }) } -func TestStringUpdateURLForwardingBody(t *testing.T) { - t.Run("StringMethod", func(t *testing.T) { +func TestEnumURLForwardingInputType(t *testing.T) { + t.Run("NewFromString_masked", func(t *testing.T) { t.Parallel() - obj := &UpdateURLForwardingBody{} - result := obj.String() - assert.NotEmpty(t, result, "String() should return a non-empty representation") + val, err := NewURLForwardingInputTypeFromString("masked") + assert.NoError(t, err, "valid enum value should not return error") + assert.Equal(t, URLForwardingInputType("masked"), val, "enum value should match expected wire value") }) - t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Run("NewFromString_redirect", func(t *testing.T) { t.Parallel() - var obj *UpdateURLForwardingBody - result := obj.String() - assert.Equal(t, "", result, "String() should return for nil receiver") + val, err := NewURLForwardingInputTypeFromString("redirect") + assert.NoError(t, err, "valid enum value should not return error") + assert.Equal(t, URLForwardingInputType("redirect"), val, "enum value should match expected wire value") + }) + + t.Run("NewFromString_302", func(t *testing.T) { + t.Parallel() + val, err := NewURLForwardingInputTypeFromString("302") + assert.NoError(t, err, "valid enum value should not return error") + assert.Equal(t, URLForwardingInputType("302"), val, "enum value should match expected wire value") + }) + + t.Run("NewFromString_Invalid", func(t *testing.T) { + _, err := NewURLForwardingInputTypeFromString("invalid_value_that_does_not_exist") + assert.Error(t, err) + }) + + t.Run("Ptr", func(t *testing.T) { + val, err := NewURLForwardingInputTypeFromString("masked") + assert.NoError(t, err) + ptr := val.Ptr() + assert.NotNil(t, ptr) + assert.Equal(t, val, *ptr) }) } @@ -2609,10 +2103,10 @@ func TestExtraPropertiesListURLForwardingsResponse(t *testing.T) { }) } -func TestExtraPropertiesURLForwarding(t *testing.T) { +func TestExtraPropertiesURLForwardingInput(t *testing.T) { t.Run("GetExtraProperties", func(t *testing.T) { t.Parallel() - obj := &URLForwarding{} + obj := &URLForwardingInput{} // Should not panic when calling GetExtraProperties() defer func() { if r := recover(); r != nil { @@ -2626,7 +2120,7 @@ func TestExtraPropertiesURLForwarding(t *testing.T) { t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { t.Parallel() - var obj *URLForwarding + var obj *URLForwardingInput extraProps := obj.GetExtraProperties() assert.Nil(t, extraProps, "nil receiver should return nil without panicking") }) @@ -2654,26 +2148,3 @@ func TestExtraPropertiesURLForwardingResponse(t *testing.T) { assert.Nil(t, extraProps, "nil receiver should return nil without panicking") }) } - -func TestExtraPropertiesUpdateURLForwardingBody(t *testing.T) { - t.Run("GetExtraProperties", func(t *testing.T) { - t.Parallel() - obj := &UpdateURLForwardingBody{} - // Should not panic when calling GetExtraProperties() - defer func() { - if r := recover(); r != nil { - t.Errorf("GetExtraProperties() panicked: %v", r) - } - }() - extraProps := obj.GetExtraProperties() - // Result can be nil or an empty/non-empty map - _ = extraProps - }) - - t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { - t.Parallel() - var obj *UpdateURLForwardingBody - extraProps := obj.GetExtraProperties() - assert.Nil(t, extraProps, "nil receiver should return nil without panicking") - }) -} diff --git a/urlforwardings/url_forwardings_test/url_forwardings_test.go b/urlforwardings/url_forwardings_test/url_forwardings_test.go index d97d6dc..c7382b9 100644 --- a/urlforwardings/url_forwardings_test/url_forwardings_test.go +++ b/urlforwardings/url_forwardings_test/url_forwardings_test.go @@ -122,10 +122,10 @@ func TestURLForwardingsCreateURLForwardingWithWireMock( ) request := &coreapigo.CreateURLForwardingRequest{ DomainName: "example.com", - Body: &coreapigo.URLForwarding{ + Body: &coreapigo.URLForwardingInput{ ForwardsTo: "https://destination-site.com", Host: "www", - Type: coreapigo.URLForwardingTypeMasked, + Type: coreapigo.URLForwardingInputTypeMasked, }, } _, invocationErr := client.URLForwardings.CreateURLForwarding( @@ -181,9 +181,10 @@ func TestURLForwardingsUpdateURLForwardingWithWireMock( request := &coreapigo.UpdateURLForwardingRequest{ DomainName: "example.com", Host: "www.example.org", - Body: &coreapigo.UpdateURLForwardingBody{ + Body: &coreapigo.URLForwardingInput{ ForwardsTo: "https://destination-site.com", - Type: coreapigo.URLForwardingTypeMasked, + Host: "www", + Type: coreapigo.URLForwardingInputTypeMasked, }, } _, invocationErr := client.URLForwardings.UpdateURLForwarding( @@ -325,9 +326,10 @@ func TestURLForwardingsUpdateURLForwardingByIDWithWireMock( request := &coreapigo.UpdateURLForwardingByIDRequest{ DomainName: "example.com", ID: 12345, - Body: &coreapigo.UpdateURLForwardingBody{ + Body: &coreapigo.URLForwardingInput{ ForwardsTo: "https://destination-site.com", - Type: coreapigo.URLForwardingTypeMasked, + Host: "www", + Type: coreapigo.URLForwardingInputTypeMasked, }, } _, invocationErr := client.URLForwardings.UpdateURLForwardingByID( diff --git a/webhook_notifications.go b/webhook_notifications.go index b1142ea..4e503d4 100644 --- a/webhook_notifications.go +++ b/webhook_notifications.go @@ -151,7 +151,9 @@ const ( AvailableWebhooksDomainTransferOutStatusChange AvailableWebhooks = "domain.transfer_out.status_change" AvailableWebhooksContactVerificationStatusChange AvailableWebhooks = "contact.verification.status_change" AvailableWebhooksDomainTransferInternalIn AvailableWebhooks = "domain.transfer.internal_in" + AvailableWebhooksDomainTransferInternalOut AvailableWebhooks = "domain.transfer.internal_out" AvailableWebhooksDomainRegistryRejection AvailableWebhooks = "domain.registry.rejection" + AvailableWebhooksDomainExpiration AvailableWebhooks = "domain.expiration" ) func NewAvailableWebhooksFromString(s string) (AvailableWebhooks, error) { @@ -168,8 +170,12 @@ func NewAvailableWebhooksFromString(s string) (AvailableWebhooks, error) { return AvailableWebhooksContactVerificationStatusChange, nil case "domain.transfer.internal_in": return AvailableWebhooksDomainTransferInternalIn, nil + case "domain.transfer.internal_out": + return AvailableWebhooksDomainTransferInternalOut, nil case "domain.registry.rejection": return AvailableWebhooksDomainRegistryRejection, nil + case "domain.expiration": + return AvailableWebhooksDomainExpiration, nil } var t AvailableWebhooks return "", fmt.Errorf("%s is not a valid %T", s, t) diff --git a/webhook_notifications_test.go b/webhook_notifications_test.go index 4de3d3b..5eb7e75 100644 --- a/webhook_notifications_test.go +++ b/webhook_notifications_test.go @@ -1404,6 +1404,13 @@ func TestEnumAvailableWebhooks(t *testing.T) { assert.Equal(t, AvailableWebhooks("domain.transfer.internal_in"), val, "enum value should match expected wire value") }) + t.Run("NewFromString_domain_transfer_internal_out", func(t *testing.T) { + t.Parallel() + val, err := NewAvailableWebhooksFromString("domain.transfer.internal_out") + assert.NoError(t, err, "valid enum value should not return error") + assert.Equal(t, AvailableWebhooks("domain.transfer.internal_out"), val, "enum value should match expected wire value") + }) + t.Run("NewFromString_domain_registry_rejection", func(t *testing.T) { t.Parallel() val, err := NewAvailableWebhooksFromString("domain.registry.rejection") @@ -1411,6 +1418,13 @@ func TestEnumAvailableWebhooks(t *testing.T) { assert.Equal(t, AvailableWebhooks("domain.registry.rejection"), val, "enum value should match expected wire value") }) + t.Run("NewFromString_domain_expiration", func(t *testing.T) { + t.Parallel() + val, err := NewAvailableWebhooksFromString("domain.expiration") + assert.NoError(t, err, "valid enum value should not return error") + assert.Equal(t, AvailableWebhooks("domain.expiration"), val, "enum value should match expected wire value") + }) + t.Run("NewFromString_Invalid", func(t *testing.T) { _, err := NewAvailableWebhooksFromString("invalid_value_that_does_not_exist") assert.Error(t, err) diff --git a/webhooknotifications/client.go b/webhooknotifications/client.go index f474dd1..8db0b14 100644 --- a/webhooknotifications/client.go +++ b/webhooknotifications/client.go @@ -55,9 +55,11 @@ func (c *Client) GetSubscribedNotifications( // - `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. func (c *Client) SubscribeToNotification( ctx context.Context, request *coreapigo.SubscribeToNotification,