Skip to content

Commit d54e073

Browse files
feat: regenerate CLI from OpenAPI spec
1 parent 582e20c commit d54e073

10 files changed

Lines changed: 1061 additions & 6 deletions

client/client.gen.go

Lines changed: 832 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package whois
2+
3+
import (
4+
"context"
5+
"log"
6+
7+
"github.com/hostinger/api-cli/api"
8+
"github.com/hostinger/api-cli/output"
9+
"github.com/spf13/cobra"
10+
)
11+
12+
var CancelPendingIrtpVerificationCmd = &cobra.Command{
13+
Use: "cancel-pending-irtp-verification <domain>",
14+
Short: "Cancel pending IRTP verification",
15+
Long: "Cancel a pending IRTP verification.\n\nUse this endpoint to back out of a WHOIS change that is stuck waiting on registrant confirmation,\nfor example when the confirmation email cannot be received, without waiting out the 5-day expiry.",
16+
Args: cobra.MatchAll(cobra.ExactArgs(1)),
17+
Run: func(cmd *cobra.Command, args []string) {
18+
r, err := api.Request().DomainsCancelPendingIRTPVerificationV1WithResponse(context.TODO(), args[0])
19+
if err != nil {
20+
log.Fatal(err)
21+
}
22+
23+
output.Format(cmd, r.Body, r.StatusCode())
24+
},
25+
}

cmd/domains/whois/change_for.go

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package whois
2+
3+
import (
4+
"bytes"
5+
"context"
6+
"encoding/json"
7+
"log"
8+
9+
"github.com/hostinger/api-cli/api"
10+
"github.com/hostinger/api-cli/output"
11+
"github.com/spf13/cobra"
12+
)
13+
14+
var ChangeForCmd = &cobra.Command{
15+
Use: "change-for",
16+
Short: "Change WHOIS profile for domain",
17+
Long: "Change WHOIS contact profile for a domain.\n\nRepoints the given contact roles to a new WHOIS profile and submits the change to the registry.\nThe profile currently assigned to those roles is resolved automatically;\nthe request fails if the given roles are not all on the same profile today.\n\nChanging transfer sensitive fields on the owner contact starts an IRTP verification.\n\nThe change is processed asynchronously.\n\nUse this endpoint to move a registered domain onto different contact information.",
18+
Run: func(cmd *cobra.Command, args []string) {
19+
payload, err := json.Marshal(changeForBody(cmd))
20+
if err != nil {
21+
log.Fatal(err)
22+
}
23+
r, err := api.Request().DomainsChangeWHOISProfileForDomainV1WithBodyWithResponse(context.TODO(), "application/json", bytes.NewReader(payload))
24+
if err != nil {
25+
log.Fatal(err)
26+
}
27+
28+
output.Format(cmd, r.Body, r.StatusCode())
29+
},
30+
}
31+
32+
func init() {
33+
ChangeForCmd.Flags().StringSliceP("change-for", "", nil, "Contact roles to repoint to the new WHOIS profile (one of: owner, admin, billing, tech)")
34+
ChangeForCmd.Flags().StringP("domain", "", "", "Domain name")
35+
ChangeForCmd.Flags().IntP("new-whois-id", "", 0, "WHOIS profile ID to assign to the domain")
36+
ChangeForCmd.MarkFlagRequired("change-for")
37+
ChangeForCmd.MarkFlagRequired("domain")
38+
ChangeForCmd.MarkFlagRequired("new-whois-id")
39+
}
40+
41+
func changeForBody(cmd *cobra.Command) map[string]any {
42+
body := map[string]any{}
43+
changeForVal, _ := cmd.Flags().GetStringSlice("change-for")
44+
body["change_for"] = changeForVal
45+
domainVal, _ := cmd.Flags().GetString("domain")
46+
body["domain"] = domainVal
47+
newWhoisIdVal, _ := cmd.Flags().GetInt("new-whois-id")
48+
body["new_whois_id"] = newWhoisIdVal
49+
return body
50+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package whois
2+
3+
import (
4+
"context"
5+
"log"
6+
7+
"github.com/hostinger/api-cli/api"
8+
"github.com/hostinger/api-cli/output"
9+
"github.com/spf13/cobra"
10+
)
11+
12+
var PendingIrtpVerificationCmd = &cobra.Command{
13+
Use: "pending-irtp-verification <domain>",
14+
Short: "Get pending IRTP verification",
15+
Long: "Retrieve a pending IRTP verification for a domain.\n\nBoth the old and new registrant must confirm it before the WHOIS change takes effect.\n\nUse this endpoint to check the status of a WHOIS change awaiting registrant confirmation.",
16+
Args: cobra.MatchAll(cobra.ExactArgs(1)),
17+
Run: func(cmd *cobra.Command, args []string) {
18+
r, err := api.Request().DomainsGetPendingIRTPVerificationV1WithResponse(context.TODO(), args[0])
19+
if err != nil {
20+
log.Fatal(err)
21+
}
22+
23+
output.Format(cmd, r.Body, r.StatusCode())
24+
},
25+
}

cmd/domains/whois/whois.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@ var GroupCmd = &cobra.Command{
1010
}
1111

1212
func init() {
13+
GroupCmd.AddCommand(CancelPendingIrtpVerificationCmd)
14+
GroupCmd.AddCommand(ChangeForCmd)
1315
GroupCmd.AddCommand(CreateCmd)
1416
GroupCmd.AddCommand(DeleteCmd)
1517
GroupCmd.AddCommand(GetCmd)
1618
GroupCmd.AddCommand(ListCmd)
19+
GroupCmd.AddCommand(PendingIrtpVerificationCmd)
1720
GroupCmd.AddCommand(SetAsDefaultCmd)
1821
GroupCmd.AddCommand(UnsetDefaultCmd)
1922
GroupCmd.AddCommand(UsageCmd)

docs/hostinger_domains_whois.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,13 @@ WHOIS commands
1818
### SEE ALSO
1919

2020
* [hostinger domains](hostinger_domains.md) - Domains commands
21+
* [hostinger domains whois cancel-pending-irtp-verification](hostinger_domains_whois_cancel-pending-irtp-verification.md) - Cancel pending IRTP verification
22+
* [hostinger domains whois change-for](hostinger_domains_whois_change-for.md) - Change WHOIS profile for domain
2123
* [hostinger domains whois create](hostinger_domains_whois_create.md) - Create WHOIS profile
2224
* [hostinger domains whois delete](hostinger_domains_whois_delete.md) - Delete WHOIS profile
2325
* [hostinger domains whois get](hostinger_domains_whois_get.md) - Get WHOIS profile
2426
* [hostinger domains whois list](hostinger_domains_whois_list.md) - Get WHOIS profile list
27+
* [hostinger domains whois pending-irtp-verification](hostinger_domains_whois_pending-irtp-verification.md) - Get pending IRTP verification
2528
* [hostinger domains whois set-as-default](hostinger_domains_whois_set-as-default.md) - Set WHOIS profile as default
2629
* [hostinger domains whois unset-default](hostinger_domains_whois_unset-default.md) - Unset default WHOIS profile
2730
* [hostinger domains whois usage](hostinger_domains_whois_usage.md) - Get WHOIS profile usage
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
## hostinger domains whois cancel-pending-irtp-verification
2+
3+
Cancel pending IRTP verification
4+
5+
### Synopsis
6+
7+
Cancel a pending IRTP verification.
8+
9+
Use this endpoint to back out of a WHOIS change that is stuck waiting on registrant confirmation,
10+
for example when the confirmation email cannot be received, without waiting out the 5-day expiry.
11+
12+
```
13+
hostinger domains whois cancel-pending-irtp-verification <domain> [flags]
14+
```
15+
16+
### Options
17+
18+
```
19+
-h, --help help for cancel-pending-irtp-verification
20+
```
21+
22+
### Options inherited from parent commands
23+
24+
```
25+
--config string Config file (default is $HOME/.hostinger.yaml)
26+
--format string Output format type (json|table|tree), default: table
27+
```
28+
29+
### SEE ALSO
30+
31+
* [hostinger domains whois](hostinger_domains_whois.md) - WHOIS commands
32+
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
## hostinger domains whois change-for
2+
3+
Change WHOIS profile for domain
4+
5+
### Synopsis
6+
7+
Change WHOIS contact profile for a domain.
8+
9+
Repoints the given contact roles to a new WHOIS profile and submits the change to the registry.
10+
The profile currently assigned to those roles is resolved automatically;
11+
the request fails if the given roles are not all on the same profile today.
12+
13+
Changing transfer sensitive fields on the owner contact starts an IRTP verification.
14+
15+
The change is processed asynchronously.
16+
17+
Use this endpoint to move a registered domain onto different contact information.
18+
19+
```
20+
hostinger domains whois change-for [flags]
21+
```
22+
23+
### Options
24+
25+
```
26+
--change-for strings Contact roles to repoint to the new WHOIS profile (one of: owner, admin, billing, tech)
27+
--domain string Domain name
28+
-h, --help help for change-for
29+
--new-whois-id int WHOIS profile ID to assign to the domain
30+
```
31+
32+
### Options inherited from parent commands
33+
34+
```
35+
--config string Config file (default is $HOME/.hostinger.yaml)
36+
--format string Output format type (json|table|tree), default: table
37+
```
38+
39+
### SEE ALSO
40+
41+
* [hostinger domains whois](hostinger_domains_whois.md) - WHOIS commands
42+
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
## hostinger domains whois pending-irtp-verification
2+
3+
Get pending IRTP verification
4+
5+
### Synopsis
6+
7+
Retrieve a pending IRTP verification for a domain.
8+
9+
Both the old and new registrant must confirm it before the WHOIS change takes effect.
10+
11+
Use this endpoint to check the status of a WHOIS change awaiting registrant confirmation.
12+
13+
```
14+
hostinger domains whois pending-irtp-verification <domain> [flags]
15+
```
16+
17+
### Options
18+
19+
```
20+
-h, --help help for pending-irtp-verification
21+
```
22+
23+
### Options inherited from parent commands
24+
25+
```
26+
--config string Config file (default is $HOME/.hostinger.yaml)
27+
--format string Output format type (json|table|tree), default: table
28+
```
29+
30+
### SEE ALSO
31+
32+
* [hostinger domains whois](hostinger_domains_whois.md) - WHOIS commands
33+

manifest.json

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,16 @@
519519
"method": "POST",
520520
"path": "/api/billing/v1/payment-methods/{paymentMethodId}"
521521
},
522+
"domains_cancelPendingIRTPVerificationV1": {
523+
"command": "hostinger domains whois cancel-pending-irtp-verification",
524+
"method": "DELETE",
525+
"path": "/api/domains/v1/irtp/{domain}"
526+
},
527+
"domains_changeWHOISProfileForDomainV1": {
528+
"command": "hostinger domains whois change-for",
529+
"method": "PUT",
530+
"path": "/api/domains/v1/whois/change"
531+
},
522532
"domains_checkDomainAvailabilityV1": {
523533
"command": "hostinger domains availability check",
524534
"method": "POST",
@@ -589,6 +599,11 @@
589599
"method": "GET",
590600
"path": "/api/domains/v1/portfolio/{domain}/renewal"
591601
},
602+
"domains_getPendingIRTPVerificationV1": {
603+
"command": "hostinger domains whois pending-irtp-verification",
604+
"method": "GET",
605+
"path": "/api/domains/v1/irtp/{domain}"
606+
},
592607
"domains_getTransferListV1": {
593608
"command": "hostinger domains transfer list",
594609
"method": "GET",
@@ -621,7 +636,7 @@
621636
},
622637
"domains_setWHOISProfileAsDefaultV1": {
623638
"command": "hostinger domains whois set-as-default",
624-
"method": "PATCH",
639+
"method": "PUT",
625640
"path": "/api/domains/v1/whois/default/{whoisId}"
626641
},
627642
"domains_unsetDefaultWHOISProfileV1": {

0 commit comments

Comments
 (0)