Skip to content

Commit a8bd3a2

Browse files
chore: regenerate CLI from OpenAPI spec
1 parent d117e5f commit a8bd3a2

12 files changed

Lines changed: 717 additions & 0 deletions

client/client.gen.go

Lines changed: 477 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
@@ -9,6 +9,7 @@ import (
99
"github.com/hostinger/api-cli/cmd/agency_hosting/files"
1010
"github.com/hostinger/api-cli/cmd/agency_hosting/website_setups"
1111
"github.com/hostinger/api-cli/cmd/agency_hosting/websites"
12+
"github.com/hostinger/api-cli/cmd/agency_hosting/wordpress"
1213

1314
"github.com/spf13/cobra"
1415
)
@@ -27,4 +28,5 @@ func init() {
2728
GroupCmd.AddCommand(files.GroupCmd)
2829
GroupCmd.AddCommand(website_setups.GroupCmd)
2930
GroupCmd.AddCommand(websites.GroupCmd)
31+
GroupCmd.AddCommand(wordpress.GroupCmd)
3032
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package wordpress
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 ChangePlanWebsiteCoreVersionCmd = &cobra.Command{
15+
Use: "change-plan-website-core-version <website_uid>",
16+
Short: "Change Agency Plan website WordPress core version",
17+
Long: "Changes the installed WordPress core version on an Agency Plan website to one of the versions available for installation.",
18+
Args: cobra.MatchAll(cobra.ExactArgs(1)),
19+
Run: func(cmd *cobra.Command, args []string) {
20+
payload, err := json.Marshal(changePlanWebsiteCoreVersionBody(cmd))
21+
if err != nil {
22+
log.Fatal(err)
23+
}
24+
r, err := api.Request().AgencyHostingChangeAgencyPlanWebsiteWordPressCoreVersionV1WithBodyWithResponse(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+
ChangePlanWebsiteCoreVersionCmd.Flags().StringP("version", "", "", "Target WordPress core version to install. Must be one of the available versions.")
35+
ChangePlanWebsiteCoreVersionCmd.MarkFlagRequired("version")
36+
}
37+
38+
func changePlanWebsiteCoreVersionBody(cmd *cobra.Command) map[string]any {
39+
body := map[string]any{}
40+
versionVal, _ := cmd.Flags().GetString("version")
41+
body["version"] = versionVal
42+
return body
43+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package wordpress
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 ListVersionsForPlanWebsiteCmd = &cobra.Command{
13+
Use: "list-versions-for-plan-website <website_uid>",
14+
Short: "List available WordPress versions for an Agency Plan website",
15+
Long: "Lists the WordPress core versions available for installation on an Agency Plan website.",
16+
Args: cobra.MatchAll(cobra.ExactArgs(1)),
17+
Run: func(cmd *cobra.Command, args []string) {
18+
r, err := api.Request().AgencyHostingListAvailableWordPressVersionsForAnAgencyPlanWebsiteV1WithResponse(context.TODO(), args[0])
19+
if err != nil {
20+
log.Fatal(err)
21+
}
22+
23+
output.Format(cmd, r.Body, r.StatusCode())
24+
},
25+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package wordpress
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 PlanWebsiteSettingsCmd = &cobra.Command{
13+
Use: "plan-website-settings <website_uid>",
14+
Short: "Get Agency Plan website WordPress settings",
15+
Long: "Returns the current WordPress settings for an Agency Plan website: installed core version,\nLiteSpeed Cache plugin status, object cache status, and maintenance mode status.",
16+
Args: cobra.MatchAll(cobra.ExactArgs(1)),
17+
Run: func(cmd *cobra.Command, args []string) {
18+
r, err := api.Request().AgencyHostingGetAgencyPlanWebsiteWordPressSettingsV1WithResponse(context.TODO(), args[0])
19+
if err != nil {
20+
log.Fatal(err)
21+
}
22+
23+
output.Format(cmd, r.Body, r.StatusCode())
24+
},
25+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package wordpress
2+
3+
import (
4+
"github.com/spf13/cobra"
5+
)
6+
7+
var GroupCmd = &cobra.Command{
8+
Use: "wordpress",
9+
Short: "WordPress commands",
10+
}
11+
12+
func init() {
13+
GroupCmd.AddCommand(ChangePlanWebsiteCoreVersionCmd)
14+
GroupCmd.AddCommand(ListVersionsForPlanWebsiteCmd)
15+
GroupCmd.AddCommand(PlanWebsiteSettingsCmd)
16+
}

docs/hostinger_agency-hosting.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ Agency Hosting commands
2626
* [hostinger agency-hosting files](hostinger_agency-hosting_files.md) - Files commands
2727
* [hostinger agency-hosting website-setups](hostinger_agency-hosting_website-setups.md) - Website Setups commands
2828
* [hostinger agency-hosting websites](hostinger_agency-hosting_websites.md) - Websites commands
29+
* [hostinger agency-hosting wordpress](hostinger_agency-hosting_wordpress.md) - WordPress commands
2930

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
## hostinger agency-hosting wordpress
2+
3+
WordPress commands
4+
5+
### Options
6+
7+
```
8+
-h, --help help for wordpress
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 wordpress change-plan-website-core-version](hostinger_agency-hosting_wordpress_change-plan-website-core-version.md) - Change Agency Plan website WordPress core version
22+
* [hostinger agency-hosting wordpress list-versions-for-plan-website](hostinger_agency-hosting_wordpress_list-versions-for-plan-website.md) - List available WordPress versions for an Agency Plan website
23+
* [hostinger agency-hosting wordpress plan-website-settings](hostinger_agency-hosting_wordpress_plan-website-settings.md) - Get Agency Plan website WordPress settings
24+
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
## hostinger agency-hosting wordpress change-plan-website-core-version
2+
3+
Change Agency Plan website WordPress core version
4+
5+
### Synopsis
6+
7+
Changes the installed WordPress core version on an Agency Plan website to one of the versions available for installation.
8+
9+
```
10+
hostinger agency-hosting wordpress change-plan-website-core-version <website_uid> [flags]
11+
```
12+
13+
### Options
14+
15+
```
16+
-h, --help help for change-plan-website-core-version
17+
--version string Target WordPress core version to install. Must be one of the available versions.
18+
```
19+
20+
### Options inherited from parent commands
21+
22+
```
23+
--config string Config file (default is $HOME/.hostinger.yaml)
24+
--format string Output format type (json|table|tree), default: table
25+
```
26+
27+
### SEE ALSO
28+
29+
* [hostinger agency-hosting wordpress](hostinger_agency-hosting_wordpress.md) - WordPress commands
30+
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
## hostinger agency-hosting wordpress list-versions-for-plan-website
2+
3+
List available WordPress versions for an Agency Plan website
4+
5+
### Synopsis
6+
7+
Lists the WordPress core versions available for installation on an Agency Plan website.
8+
9+
```
10+
hostinger agency-hosting wordpress list-versions-for-plan-website <website_uid> [flags]
11+
```
12+
13+
### Options
14+
15+
```
16+
-h, --help help for list-versions-for-plan-website
17+
```
18+
19+
### Options inherited from parent commands
20+
21+
```
22+
--config string Config file (default is $HOME/.hostinger.yaml)
23+
--format string Output format type (json|table|tree), default: table
24+
```
25+
26+
### SEE ALSO
27+
28+
* [hostinger agency-hosting wordpress](hostinger_agency-hosting_wordpress.md) - WordPress commands
29+

0 commit comments

Comments
 (0)