Skip to content

Commit 9d581c4

Browse files
feat: regenerate CLI from OpenAPI spec
1 parent e1aa1bd commit 9d581c4

10 files changed

Lines changed: 534 additions & 1 deletion

client/client.gen.go

Lines changed: 398 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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/hostinger/api-cli/utils"
10+
"github.com/spf13/cobra"
11+
)
12+
13+
var SetAsDefaultCmd = &cobra.Command{
14+
Use: "set-as-default <whois-id>",
15+
Short: "Set WHOIS profile as default",
16+
Long: "Set WHOIS contact profile as default.\n\nThe default profile is pre-selected for the TLD it belongs to when registering new domains.\n\nUse this endpoint to avoid picking contact information for every registration.",
17+
Args: cobra.MatchAll(cobra.ExactArgs(1)),
18+
Run: func(cmd *cobra.Command, args []string) {
19+
r, err := api.Request().DomainsSetWHOISProfileAsDefaultV1WithResponse(context.TODO(), utils.StringToInt(args[0]))
20+
if err != nil {
21+
log.Fatal(err)
22+
}
23+
24+
output.Format(cmd, r.Body, r.StatusCode())
25+
},
26+
}

cmd/domains/whois/unset_default.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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/hostinger/api-cli/utils"
10+
"github.com/spf13/cobra"
11+
)
12+
13+
var UnsetDefaultCmd = &cobra.Command{
14+
Use: "unset-default <whois-id>",
15+
Short: "Unset default WHOIS profile",
16+
Long: "Unset WHOIS contact profile as default.\n\nThe profile itself is kept, it is only no longer pre-selected for its TLD.\n\nUse this endpoint to stop reusing contact information for new registrations.",
17+
Args: cobra.MatchAll(cobra.ExactArgs(1)),
18+
Run: func(cmd *cobra.Command, args []string) {
19+
r, err := api.Request().DomainsUnsetDefaultWHOISProfileV1WithResponse(context.TODO(), utils.StringToInt(args[0]))
20+
if err != nil {
21+
log.Fatal(err)
22+
}
23+
24+
output.Format(cmd, r.Body, r.StatusCode())
25+
},
26+
}

cmd/domains/whois/whois.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,7 @@ func init() {
1414
GroupCmd.AddCommand(DeleteCmd)
1515
GroupCmd.AddCommand(GetCmd)
1616
GroupCmd.AddCommand(ListCmd)
17+
GroupCmd.AddCommand(SetAsDefaultCmd)
18+
GroupCmd.AddCommand(UnsetDefaultCmd)
1719
GroupCmd.AddCommand(UsageCmd)
1820
}

cmd/vps/virtual_machines/stop.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
var StopCmd = &cobra.Command{
1414
Use: "stop <virtual-machine-id>",
1515
Short: "Stop virtual machine",
16-
Long: "Stop a specified virtual machine.\n\nIf the virtual machine is already stopped, the request will still be processed without any effect.\n\nUse this endpoint to power off running VPS instances.",
16+
Long: "Stop a specified virtual machine.\n\nIf the virtual machine is already stopped, the request will still be processed without any effect.\n\nThis is a compute-only power state change and does not affect billing. To stop future charges,\ndisable auto-renewal on the owning subscription.\n\nUse this endpoint to power off running VPS instances.",
1717
Args: cobra.MatchAll(cobra.ExactArgs(1)),
1818
Run: func(cmd *cobra.Command, args []string) {
1919
r, err := api.Request().VPSStopVirtualMachineV1WithResponse(context.TODO(), utils.StringToInt(args[0]))

docs/hostinger_domains_whois.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,7 @@ WHOIS commands
2222
* [hostinger domains whois delete](hostinger_domains_whois_delete.md) - Delete WHOIS profile
2323
* [hostinger domains whois get](hostinger_domains_whois_get.md) - Get WHOIS profile
2424
* [hostinger domains whois list](hostinger_domains_whois_list.md) - Get WHOIS profile list
25+
* [hostinger domains whois set-as-default](hostinger_domains_whois_set-as-default.md) - Set WHOIS profile as default
26+
* [hostinger domains whois unset-default](hostinger_domains_whois_unset-default.md) - Unset default WHOIS profile
2527
* [hostinger domains whois usage](hostinger_domains_whois_usage.md) - Get WHOIS profile usage
2628

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
## hostinger domains whois set-as-default
2+
3+
Set WHOIS profile as default
4+
5+
### Synopsis
6+
7+
Set WHOIS contact profile as default.
8+
9+
The default profile is pre-selected for the TLD it belongs to when registering new domains.
10+
11+
Use this endpoint to avoid picking contact information for every registration.
12+
13+
```
14+
hostinger domains whois set-as-default <whois-id> [flags]
15+
```
16+
17+
### Options
18+
19+
```
20+
-h, --help help for set-as-default
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+
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
## hostinger domains whois unset-default
2+
3+
Unset default WHOIS profile
4+
5+
### Synopsis
6+
7+
Unset WHOIS contact profile as default.
8+
9+
The profile itself is kept, it is only no longer pre-selected for its TLD.
10+
11+
Use this endpoint to stop reusing contact information for new registrations.
12+
13+
```
14+
hostinger domains whois unset-default <whois-id> [flags]
15+
```
16+
17+
### Options
18+
19+
```
20+
-h, --help help for unset-default
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+

docs/hostinger_vps_virtual-machines_stop.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ Stop a specified virtual machine.
88

99
If the virtual machine is already stopped, the request will still be processed without any effect.
1010

11+
This is a compute-only power state change and does not affect billing. To stop future charges,
12+
disable auto-renewal on the owning subscription.
13+
1114
Use this endpoint to power off running VPS instances.
1215

1316
```

manifest.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,16 @@
619619
"method": "POST",
620620
"path": "/api/domains/v1/portfolio"
621621
},
622+
"domains_setWHOISProfileAsDefaultV1": {
623+
"command": "hostinger domains whois set-as-default",
624+
"method": "PATCH",
625+
"path": "/api/domains/v1/whois/default/{whoisId}"
626+
},
627+
"domains_unsetDefaultWHOISProfileV1": {
628+
"command": "hostinger domains whois unset-default",
629+
"method": "DELETE",
630+
"path": "/api/domains/v1/whois/default/{whoisId}"
631+
},
622632
"domains_updateDomainForwardingV1": {
623633
"command": "hostinger domains forwarding update",
624634
"method": "PUT",

0 commit comments

Comments
 (0)