Skip to content

Commit 673f590

Browse files
feat: regenerate CLI from OpenAPI spec
1 parent abcee73 commit 673f590

11 files changed

Lines changed: 394 additions & 29 deletions

‎.github/workflows/release.yaml‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,22 @@ on:
1111
default: ''
1212

1313
permissions:
14-
contents: read
14+
contents: write
1515

1616
jobs:
1717
release:
1818
runs-on: ubuntu-latest
19-
environment: release
2019
steps:
2120
- name: Get GitHub token
22-
uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0
21+
uses: actions/create-github-app-token@v3
2322
id: get_token
2423
with:
25-
client-id: ${{ secrets.HOSTINGERBOT_PUBLIC_CLIENT_ID }}
26-
private-key: ${{ secrets.HOSTINGERBOT_PUBLIC_PRIVATE_KEY }}
27-
owner: ${{ github.repository_owner }}
24+
app-id: ${{ secrets.HOSTINGERBOT_APP_ID }}
25+
private-key: ${{ secrets.HOSTINGERBOT_PRIVATE_KEY }}
26+
owner: hostinger
2827
repositories: |
2928
api-cli
3029
homebrew-tap
31-
permission-contents: write
3230
3331
- name: Repo checkout
3432
uses: actions/checkout@v7

‎client/client.gen.go‎

Lines changed: 289 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package integrations
2+
3+
import (
4+
"context"
5+
6+
"github.com/hostinger/api-cli/api"
7+
"github.com/hostinger/api-cli/output"
8+
"github.com/hostinger/api-cli/utils"
9+
"github.com/spf13/cobra"
10+
)
11+
12+
var ConnectEcommerceStoreCmd = &cobra.Command{
13+
Use: "connect-ecommerce-store <profile-uuid> <store-id>",
14+
Short: "Connect Ecommerce store",
15+
Long: "Connect one of the customer's eCommerce stores to the profile, so Reach receives its\ncustomers and orders.\n\nTake `store_id` from the list eCommerce stores endpoint. Fails with not found\n(`ECOMMERCE_STORE_NOT_FOUND`) when the store is not one of the customer's own stores, also\nwhen the eCommerce service cannot be reached. Fails with a conflict\n(`ECOMMERCE_CONNECTION_ALREADY_EXISTS`) when the store is connected to any profile or this\nprofile already has a store - to move a store to another plan, disconnect it from the\nprofile that holds it first.",
16+
Example: " hostinger reach integrations connect-ecommerce-store 550e8400-e09b-41d4-a716-400055000000 ec_123",
17+
ValidArgsFunction: cobra.NoFileCompletions,
18+
RunE: func(cmd *cobra.Command, args []string) error {
19+
args = utils.PromptedArgs(cmd, args)
20+
call := func(ctx context.Context) ([]byte, int, error) {
21+
r, err := api.Request().ReachConnectEcommerceStoreV1WithResponse(ctx, args[0], args[1])
22+
if err != nil {
23+
return nil, 0, err
24+
}
25+
return r.Body, r.StatusCode(), nil
26+
}
27+
respBody, status, err := call(cmd.Context())
28+
if err != nil {
29+
return err
30+
}
31+
return output.Format(cmd, respBody, status)
32+
},
33+
}
34+
35+
func init() {
36+
utils.RegisterArgs(ConnectEcommerceStoreCmd, utils.StringArg("profile-uuid"), utils.StringArg("store-id"))
37+
}

‎cmd/reach/integrations/disconnect_ecommerce_store.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
var DisconnectEcommerceStoreCmd = &cobra.Command{
1313
Use: "disconnect-ecommerce-store <profile-uuid> <store-id>",
1414
Short: "Disconnect Ecommerce store",
15-
Long: "Disconnect an eCommerce store from the profile.\n\nReach stops receiving the store's customers and orders, and its products and coupons are\nremoved from Reach; contacts and past orders stay. Take `store_id` from the list eCommerce\nstores endpoint; for a store that is `connected_to_other_profile`, call this with that\nprofile. Also succeeds when the store is not connected to this profile, so success is not\nproof that anything was disconnected. Confirm the store and the plan with the customer\nbefore calling.",
15+
Long: "Disconnect an eCommerce store from the profile.\n\nReach stops receiving the store's customers and orders, and its products and coupons are\nremoved from Reach; contacts and past orders stay. Take `store_id` from the list eCommerce\nstores endpoint; for a store that is `connected_to_other_profile`, call this with that\nprofile. Also succeeds when the store is not connected to this profile, so success is not\nproof that anything was disconnected. To move the store to another plan, connect it to the\nnew profile afterwards. Confirm the store and the plan with the customer before calling.",
1616
Example: " hostinger reach integrations disconnect-ecommerce-store 550e8400-e09b-41d4-a716-400055000000 ec_123",
1717
ValidArgsFunction: cobra.NoFileCompletions,
1818
RunE: func(cmd *cobra.Command, args []string) error {

‎cmd/reach/integrations/integrations.go‎

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

1515
func init() {
1616
GroupCmd.AddCommand(ConnectAiWebsiteBuilderSiteCmd)
17+
GroupCmd.AddCommand(ConnectEcommerceStoreCmd)
1718
GroupCmd.AddCommand(DisconnectAiWebsiteBuilderSiteCmd)
1819
GroupCmd.AddCommand(DisconnectEcommerceStoreCmd)
1920
GroupCmd.AddCommand(DisconnectWordpressSiteCmd)

‎cmd/reach/integrations/list_ecommerce_stores.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
var ListEcommerceStoresCmd = &cobra.Command{
1313
Use: "list-ecommerce-stores <profile-uuid>",
1414
Short: "List Ecommerce stores",
15-
Long: "Get all of the customer's Hostinger eCommerce stores, each with its `store_id` and\n`connection_status` for the profile in the path.\n\nA store is connected to at most one profile. `connected_to_other_profile` does not name that\nprofile - call this for each profile to find it. The list is empty, not an error, when the\neCommerce service cannot be reached. Pass `store_id` to the disconnect eCommerce store\nendpoint. Connecting an AI Website Builder site connects the store selling on it.",
15+
Long: "Get all of the customer's Hostinger eCommerce stores, each with its `store_id` and\n`connection_status` for the profile in the path.\n\nA store is connected to at most one profile. `connected_to_other_profile` does not name that\nprofile - call this for each profile to find it. The list is empty, not an error, when the\neCommerce service cannot be reached. Pass `store_id` to the connect or disconnect eCommerce\nstore endpoint.",
1616
Example: " hostinger reach integrations list-ecommerce-stores 550e8400-e09b-41d4-a716-400055000000",
1717
ValidArgsFunction: cobra.NoFileCompletions,
1818
RunE: func(cmd *cobra.Command, args []string) error {

‎docs/hostinger_reach_integrations.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ hostinger reach integrations [flags]
3030

3131
* [hostinger reach](hostinger_reach.md) - Reach commands
3232
* [hostinger reach integrations connect-ai-website-builder-site](hostinger_reach_integrations_connect-ai-website-builder-site.md) - Connect AI Website Builder site
33+
* [hostinger reach integrations connect-ecommerce-store](hostinger_reach_integrations_connect-ecommerce-store.md) - Connect Ecommerce store
3334
* [hostinger reach integrations disconnect-ai-website-builder-site](hostinger_reach_integrations_disconnect-ai-website-builder-site.md) - Disconnect AI Website Builder site
3435
* [hostinger reach integrations disconnect-ecommerce-store](hostinger_reach_integrations_disconnect-ecommerce-store.md) - Disconnect Ecommerce store
3536
* [hostinger reach integrations disconnect-wordpress-site](hostinger_reach_integrations_disconnect-wordpress-site.md) - Disconnect WordPress site
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
## hostinger reach integrations connect-ecommerce-store
2+
3+
Connect Ecommerce store
4+
5+
### Synopsis
6+
7+
Connect one of the customer's eCommerce stores to the profile, so Reach receives its
8+
customers and orders.
9+
10+
Take `store_id` from the list eCommerce stores endpoint. Fails with not found
11+
(`ECOMMERCE_STORE_NOT_FOUND`) when the store is not one of the customer's own stores, also
12+
when the eCommerce service cannot be reached. Fails with a conflict
13+
(`ECOMMERCE_CONNECTION_ALREADY_EXISTS`) when the store is connected to any profile or this
14+
profile already has a store - to move a store to another plan, disconnect it from the
15+
profile that holds it first.
16+
17+
```
18+
hostinger reach integrations connect-ecommerce-store <profile-uuid> <store-id> [flags]
19+
```
20+
21+
### Examples
22+
23+
```
24+
hostinger reach integrations connect-ecommerce-store 550e8400-e09b-41d4-a716-400055000000 ec_123
25+
```
26+
27+
### Options
28+
29+
```
30+
-h, --help help for connect-ecommerce-store
31+
```
32+
33+
### Options inherited from parent commands
34+
35+
```
36+
--config string Config file (default is $HOME/.hostinger.yaml)
37+
--domain string Website domain for commands that act on a website (default: HOSTINGER_DOMAIN, .hostinger/site.json, or default_domain in the config)
38+
--dry-run Print the request as a curl command instead of sending it
39+
-o, --format string Output format: table|json|yaml|tree (default: table on a terminal, json when piped)
40+
--jq string Filter the JSON response with a jq expression, e.g. '.data[].id'
41+
--no-input Never prompt; fail when an argument, flag or confirmation is missing
42+
--order-id string Order for commands that act on an order (default: HOSTINGER_ORDER_ID, .hostinger/site.json for hosting, or a prompt)
43+
--username string Hosting account for commands that act on an account (default: HOSTINGER_USERNAME, the website from --domain, or .hostinger/site.json)
44+
--verbose Print the config file used and each HTTP request to stderr
45+
```
46+
47+
### SEE ALSO
48+
49+
* [hostinger reach integrations](hostinger_reach_integrations.md) - Integrations commands
50+

‎docs/hostinger_reach_integrations_disconnect-ecommerce-store.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ Reach stops receiving the store's customers and orders, and its products and cou
1010
removed from Reach; contacts and past orders stay. Take `store_id` from the list eCommerce
1111
stores endpoint; for a store that is `connected_to_other_profile`, call this with that
1212
profile. Also succeeds when the store is not connected to this profile, so success is not
13-
proof that anything was disconnected. Confirm the store and the plan with the customer
14-
before calling.
13+
proof that anything was disconnected. To move the store to another plan, connect it to the
14+
new profile afterwards. Confirm the store and the plan with the customer before calling.
1515

1616
```
1717
hostinger reach integrations disconnect-ecommerce-store <profile-uuid> <store-id> [flags]

‎docs/hostinger_reach_integrations_list-ecommerce-stores.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ Get all of the customer's Hostinger eCommerce stores, each with its `store_id` a
99

1010
A store is connected to at most one profile. `connected_to_other_profile` does not name that
1111
profile - call this for each profile to find it. The list is empty, not an error, when the
12-
eCommerce service cannot be reached. Pass `store_id` to the disconnect eCommerce store
13-
endpoint. Connecting an AI Website Builder site connects the store selling on it.
12+
eCommerce service cannot be reached. Pass `store_id` to the connect or disconnect eCommerce
13+
store endpoint.
1414

1515
```
1616
hostinger reach integrations list-ecommerce-stores <profile-uuid> [flags]

0 commit comments

Comments
 (0)