Skip to content

Commit e568bd4

Browse files
feat: regenerate CLI from OpenAPI spec
1 parent 3e2cdb5 commit e568bd4

14 files changed

Lines changed: 644 additions & 0 deletions

client/client.gen.go

Lines changed: 416 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/domains/domains.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"github.com/hostinger/api-cli/cmd/domains/availability"
55
"github.com/hostinger/api-cli/cmd/domains/forwarding"
66
"github.com/hostinger/api-cli/cmd/domains/portfolio"
7+
"github.com/hostinger/api-cli/cmd/domains/transfer"
78
"github.com/hostinger/api-cli/cmd/domains/verifications"
89
"github.com/hostinger/api-cli/cmd/domains/whois"
910

@@ -19,6 +20,7 @@ func init() {
1920
GroupCmd.AddCommand(availability.GroupCmd)
2021
GroupCmd.AddCommand(forwarding.GroupCmd)
2122
GroupCmd.AddCommand(portfolio.GroupCmd)
23+
GroupCmd.AddCommand(transfer.GroupCmd)
2224
GroupCmd.AddCommand(verifications.GroupCmd)
2325
GroupCmd.AddCommand(whois.GroupCmd)
2426
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package portfolio
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 AuthorizationCodeCmd = &cobra.Command{
13+
Use: "authorization-code <domain>",
14+
Short: "Get domain authorization code",
15+
Long: "Retrieve the authorization (EPP) code for a specified domain so it can be transferred\naway from Hostinger to another registrar.\n\nRequesting a new code invalidates any code retrieved previously.\n\nUse this endpoint to obtain the code required to transfer a domain to another registrar.",
16+
Args: cobra.MatchAll(cobra.ExactArgs(1)),
17+
Run: func(cmd *cobra.Command, args []string) {
18+
r, err := api.Request().DomainsGetDomainAuthorizationCodeV1WithResponse(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/portfolio/portfolio.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ var GroupCmd = &cobra.Command{
1010
}
1111

1212
func init() {
13+
GroupCmd.AddCommand(AuthorizationCodeCmd)
1314
GroupCmd.AddCommand(DisableLockCmd)
1415
GroupCmd.AddCommand(DisablePrivacyProtectionCmd)
1516
GroupCmd.AddCommand(EnableLockCmd)

cmd/domains/transfer/get.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package transfer
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 GetCmd = &cobra.Command{
13+
Use: "get <domain>",
14+
Short: "Get transfer",
15+
Long: "Retrieve the transfer for a specified domain.\n\nUse this endpoint to track an incoming or outgoing registrar transfer and its status.",
16+
Args: cobra.MatchAll(cobra.ExactArgs(1)),
17+
Run: func(cmd *cobra.Command, args []string) {
18+
r, err := api.Request().DomainsGetTransferV1WithResponse(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/transfer/list.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package transfer
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 ListCmd = &cobra.Command{
13+
Use: "list",
14+
Short: "Get transfer list",
15+
Long: "Retrieve all domain transfers in your portfolio.\n\nUse this endpoint to monitor incoming and outgoing registrar transfers across your domains.",
16+
Run: func(cmd *cobra.Command, args []string) {
17+
r, err := api.Request().DomainsGetTransferListV1WithResponse(context.TODO())
18+
if err != nil {
19+
log.Fatal(err)
20+
}
21+
22+
output.Format(cmd, r.Body, r.StatusCode())
23+
},
24+
}

cmd/domains/transfer/transfer.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package transfer
2+
3+
import (
4+
"github.com/spf13/cobra"
5+
)
6+
7+
var GroupCmd = &cobra.Command{
8+
Use: "transfer",
9+
Short: "Transfer commands",
10+
}
11+
12+
func init() {
13+
GroupCmd.AddCommand(GetCmd)
14+
GroupCmd.AddCommand(ListCmd)
15+
}

docs/hostinger_domains.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Domains commands
2121
* [hostinger domains availability](hostinger_domains_availability.md) - Availability commands
2222
* [hostinger domains forwarding](hostinger_domains_forwarding.md) - Forwarding commands
2323
* [hostinger domains portfolio](hostinger_domains_portfolio.md) - Portfolio commands
24+
* [hostinger domains transfer](hostinger_domains_transfer.md) - Transfer commands
2425
* [hostinger domains verifications](hostinger_domains_verifications.md) - Verifications commands
2526
* [hostinger domains whois](hostinger_domains_whois.md) - WHOIS commands
2627

docs/hostinger_domains_portfolio.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Portfolio commands
1818
### SEE ALSO
1919

2020
* [hostinger domains](hostinger_domains.md) - Domains commands
21+
* [hostinger domains portfolio authorization-code](hostinger_domains_portfolio_authorization-code.md) - Get domain authorization code
2122
* [hostinger domains portfolio disable-lock](hostinger_domains_portfolio_disable-lock.md) - Disable domain lock
2223
* [hostinger domains portfolio disable-privacy-protection](hostinger_domains_portfolio_disable-privacy-protection.md) - Disable privacy protection
2324
* [hostinger domains portfolio enable-lock](hostinger_domains_portfolio_enable-lock.md) - Enable domain lock
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
## hostinger domains portfolio authorization-code
2+
3+
Get domain authorization code
4+
5+
### Synopsis
6+
7+
Retrieve the authorization (EPP) code for a specified domain so it can be transferred
8+
away from Hostinger to another registrar.
9+
10+
Requesting a new code invalidates any code retrieved previously.
11+
12+
Use this endpoint to obtain the code required to transfer a domain to another registrar.
13+
14+
```
15+
hostinger domains portfolio authorization-code <domain> [flags]
16+
```
17+
18+
### Options
19+
20+
```
21+
-h, --help help for authorization-code
22+
```
23+
24+
### Options inherited from parent commands
25+
26+
```
27+
--config string Config file (default is $HOME/.hostinger.yaml)
28+
--format string Output format type (json|table|tree), default: table
29+
```
30+
31+
### SEE ALSO
32+
33+
* [hostinger domains portfolio](hostinger_domains_portfolio.md) - Portfolio commands
34+

0 commit comments

Comments
 (0)