Skip to content

Commit dabe8a5

Browse files
chore: regenerate CLI from OpenAPI spec
1 parent e38e02b commit dabe8a5

8 files changed

Lines changed: 308 additions & 0 deletions

client/client.gen.go

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

cmd/agency_hosting/agency_hosting.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package agency_hosting
33
import (
44
"github.com/hostinger/api-cli/cmd/agency_hosting/datacenters"
55
"github.com/hostinger/api-cli/cmd/agency_hosting/domains"
6+
"github.com/hostinger/api-cli/cmd/agency_hosting/files"
67
"github.com/hostinger/api-cli/cmd/agency_hosting/website_setups"
78
"github.com/hostinger/api-cli/cmd/agency_hosting/websites"
89

@@ -17,6 +18,7 @@ var GroupCmd = &cobra.Command{
1718
func init() {
1819
GroupCmd.AddCommand(datacenters.GroupCmd)
1920
GroupCmd.AddCommand(domains.GroupCmd)
21+
GroupCmd.AddCommand(files.GroupCmd)
2022
GroupCmd.AddCommand(website_setups.GroupCmd)
2123
GroupCmd.AddCommand(websites.GroupCmd)
2224
}

cmd/agency_hosting/files/files.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package files
2+
3+
import (
4+
"github.com/spf13/cobra"
5+
)
6+
7+
var GroupCmd = &cobra.Command{
8+
Use: "files",
9+
Short: "Files commands",
10+
}
11+
12+
func init() {
13+
GroupCmd.AddCommand(ImportPlanWebsiteFromArchiveCmd)
14+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package files
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 ImportPlanWebsiteFromArchiveCmd = &cobra.Command{
15+
Use: "import-plan-website-from-archive <website_uid>",
16+
Short: "Import Agency Plan website from archive",
17+
Long: "Imports an Agency Plan website from an already-uploaded archive.\n\nUpload the archive to the website's root directory via file browser first, then provide its\nfilename in this request. Website contents are overwritten by the archive contents. Supported\narchive types: .zip, .tar, .tar.gz, .tgz.",
18+
Args: cobra.MatchAll(cobra.ExactArgs(1)),
19+
Run: func(cmd *cobra.Command, args []string) {
20+
payload, err := json.Marshal(importPlanWebsiteFromArchiveBody(cmd))
21+
if err != nil {
22+
log.Fatal(err)
23+
}
24+
r, err := api.Request().AgencyHostingImportAgencyPlanWebsiteFromArchiveV1WithBodyWithResponse(context.TODO(), args[0], "application/json", bytes.NewReader(payload))
25+
if err != nil {
26+
log.Fatal(err)
27+
}
28+
29+
output.Format(cmd, r.Body, r.StatusCode())
30+
},
31+
}
32+
33+
func init() {
34+
ImportPlanWebsiteFromArchiveCmd.Flags().StringP("archive-name", "", "", "Archive filename (e.g., archive.zip). The file must already be uploaded to the website's .h5g/ directory.")
35+
ImportPlanWebsiteFromArchiveCmd.MarkFlagRequired("archive-name")
36+
}
37+
38+
func importPlanWebsiteFromArchiveBody(cmd *cobra.Command) map[string]any {
39+
body := map[string]any{}
40+
archiveNameVal, _ := cmd.Flags().GetString("archive-name")
41+
body["archive_name"] = archiveNameVal
42+
return body
43+
}

docs/hostinger_agency-hosting.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Agency Hosting commands
2020
* [hostinger](hostinger.md) - Hostinger API Command Line Interface
2121
* [hostinger agency-hosting datacenters](hostinger_agency-hosting_datacenters.md) - Datacenters commands
2222
* [hostinger agency-hosting domains](hostinger_agency-hosting_domains.md) - Domains commands
23+
* [hostinger agency-hosting files](hostinger_agency-hosting_files.md) - Files commands
2324
* [hostinger agency-hosting website-setups](hostinger_agency-hosting_website-setups.md) - Website Setups commands
2425
* [hostinger agency-hosting websites](hostinger_agency-hosting_websites.md) - Websites commands
2526

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## hostinger agency-hosting files
2+
3+
Files commands
4+
5+
### Options
6+
7+
```
8+
-h, --help help for files
9+
```
10+
11+
### Options inherited from parent commands
12+
13+
```
14+
--config string Config file (default is $HOME/.hostinger.yaml)
15+
--format string Output format type (json|table|tree), default: table
16+
```
17+
18+
### SEE ALSO
19+
20+
* [hostinger agency-hosting](hostinger_agency-hosting.md) - Agency Hosting commands
21+
* [hostinger agency-hosting files import-plan-website-from-archive](hostinger_agency-hosting_files_import-plan-website-from-archive.md) - Import Agency Plan website from archive
22+
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
## hostinger agency-hosting files import-plan-website-from-archive
2+
3+
Import Agency Plan website from archive
4+
5+
### Synopsis
6+
7+
Imports an Agency Plan website from an already-uploaded archive.
8+
9+
Upload the archive to the website's root directory via file browser first, then provide its
10+
filename in this request. Website contents are overwritten by the archive contents. Supported
11+
archive types: .zip, .tar, .tar.gz, .tgz.
12+
13+
```
14+
hostinger agency-hosting files import-plan-website-from-archive <website_uid> [flags]
15+
```
16+
17+
### Options
18+
19+
```
20+
--archive-name string Archive filename (e.g., archive.zip). The file must already be uploaded to the website's .h5g/ directory.
21+
-h, --help help for import-plan-website-from-archive
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 agency-hosting files](hostinger_agency-hosting_files.md) - Files commands
34+

0 commit comments

Comments
 (0)