Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/revenuecat-cli/commands/apps/apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
10 changes: 8 additions & 2 deletions cmd/revenuecat-cli/commands/customers/customers.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ var (
startAfter string
allPages bool
attributes string
expiresAt int64
)

// CustomersCmd manages customers
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cmd/revenuecat-cli/commands/entitlements/entitlements.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
Loading