|
21 | 21 | startAfter string |
22 | 22 | allPages bool |
23 | 23 | attributes string |
| 24 | + expiresAt int64 |
24 | 25 | ) |
25 | 26 |
|
26 | 27 | // CustomersCmd manages customers |
@@ -191,8 +192,10 @@ func init() { |
191 | 192 | // Grant entitlement flags |
192 | 193 | grantEntitlementCmd.Flags().StringVar(&customerID, "customer-id", "", "customer ID") |
193 | 194 | grantEntitlementCmd.Flags().StringVar(&entitlementID, "entitlement-id", "", "entitlement ID") |
| 195 | + grantEntitlementCmd.Flags().Int64Var(&expiresAt, "expires-at", 0, "expiry date in ms since epoch (required by the API)") |
194 | 196 | grantEntitlementCmd.MarkFlagRequired("customer-id") |
195 | 197 | grantEntitlementCmd.MarkFlagRequired("entitlement-id") |
| 198 | + grantEntitlementCmd.MarkFlagRequired("expires-at") |
196 | 199 |
|
197 | 200 | // Revoke entitlement flags |
198 | 201 | revokeEntitlementCmd.Flags().StringVar(&customerID, "customer-id", "", "customer ID") |
@@ -347,7 +350,7 @@ func runCreate(cmd *cobra.Command, args []string) error { |
347 | 350 | ctx, cancel := client.Context() |
348 | 351 | defer cancel() |
349 | 352 |
|
350 | | - body := map[string]interface{}{"app_user_id": customerID} |
| 353 | + body := map[string]interface{}{"id": customerID} |
351 | 354 | path := fmt.Sprintf("/projects/%s/customers", client.GetProjectID()) |
352 | 355 | var customer map[string]interface{} |
353 | 356 | if err := client.Post(ctx, path, body, &customer); err != nil { |
@@ -655,7 +658,10 @@ func runGrantEntitlement(cmd *cobra.Command, args []string) error { |
655 | 658 | ctx, cancel := client.Context() |
656 | 659 | defer cancel() |
657 | 660 |
|
658 | | - body := map[string]interface{}{"entitlement_id": entitlementID} |
| 661 | + body := map[string]interface{}{ |
| 662 | + "entitlement_id": entitlementID, |
| 663 | + "expires_at": expiresAt, |
| 664 | + } |
659 | 665 | path := fmt.Sprintf("/projects/%s/customers/%s/actions/grant_entitlement", client.GetProjectID(), customerID) |
660 | 666 | if err := client.Post(ctx, path, body, nil); err != nil { |
661 | 667 | return err |
|
0 commit comments