diff --git a/cmd/revenuecat-cli/commands/apps/apps.go b/cmd/revenuecat-cli/commands/apps/apps.go index 6f502a1..65300ef 100644 --- a/cmd/revenuecat-cli/commands/apps/apps.go +++ b/cmd/revenuecat-cli/commands/apps/apps.go @@ -412,7 +412,7 @@ func runAPIKeys(cmd *cobra.Command, args []string) error { } `json:"items"` } - path := fmt.Sprintf("/projects/%s/apps/%s/api_keys", client.GetProjectID(), appID) + path := fmt.Sprintf("/projects/%s/apps/%s/public_api_keys", client.GetProjectID(), appID) if err := client.Get(ctx, path, &resp); err != nil { return err } diff --git a/cmd/revenuecat-cli/commands/customers/customers.go b/cmd/revenuecat-cli/commands/customers/customers.go index 421da11..6f59abb 100644 --- a/cmd/revenuecat-cli/commands/customers/customers.go +++ b/cmd/revenuecat-cli/commands/customers/customers.go @@ -21,6 +21,7 @@ var ( startAfter string allPages bool attributes string + expiresAt int64 ) // CustomersCmd manages customers @@ -191,8 +192,10 @@ func init() { // Grant entitlement flags grantEntitlementCmd.Flags().StringVar(&customerID, "customer-id", "", "customer ID") grantEntitlementCmd.Flags().StringVar(&entitlementID, "entitlement-id", "", "entitlement ID") + grantEntitlementCmd.Flags().Int64Var(&expiresAt, "expires-at", 0, "expiry date in ms since epoch (required by the API)") grantEntitlementCmd.MarkFlagRequired("customer-id") grantEntitlementCmd.MarkFlagRequired("entitlement-id") + grantEntitlementCmd.MarkFlagRequired("expires-at") // Revoke entitlement flags revokeEntitlementCmd.Flags().StringVar(&customerID, "customer-id", "", "customer ID") @@ -347,7 +350,7 @@ func runCreate(cmd *cobra.Command, args []string) error { ctx, cancel := client.Context() defer cancel() - body := map[string]interface{}{"app_user_id": customerID} + body := map[string]interface{}{"id": customerID} path := fmt.Sprintf("/projects/%s/customers", client.GetProjectID()) var customer map[string]interface{} if err := client.Post(ctx, path, body, &customer); err != nil { @@ -655,7 +658,10 @@ func runGrantEntitlement(cmd *cobra.Command, args []string) error { ctx, cancel := client.Context() defer cancel() - body := map[string]interface{}{"entitlement_id": entitlementID} + body := map[string]interface{}{ + "entitlement_id": entitlementID, + "expires_at": expiresAt, + } path := fmt.Sprintf("/projects/%s/customers/%s/actions/grant_entitlement", client.GetProjectID(), customerID) if err := client.Post(ctx, path, body, nil); err != nil { return err diff --git a/cmd/revenuecat-cli/commands/entitlements/entitlements.go b/cmd/revenuecat-cli/commands/entitlements/entitlements.go index e01c4c7..11fb22b 100644 --- a/cmd/revenuecat-cli/commands/entitlements/entitlements.go +++ b/cmd/revenuecat-cli/commands/entitlements/entitlements.go @@ -276,7 +276,7 @@ func runUpdate(cmd *cobra.Command, args []string) error { var ent EntitlementInfo path := fmt.Sprintf("/projects/%s/entitlements/%s", client.GetProjectID(), entitlementID) - if err := client.Patch(ctx, path, body, &ent); err != nil { + if err := client.Post(ctx, path, body, &ent); err != nil { return err }