Skip to content

Commit

Permalink
optimize optional fields in entitlement struct
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoffi committed Oct 5, 2024
1 parent e9b116e commit d9d9f4b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions restapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -3533,11 +3533,11 @@ func (s *Session) Entitlements(appID string, filterOptions *EntitlementFilterOpt
if filterOptions.SkuIDs != nil && len(filterOptions.SkuIDs) > 0 {
queryParams.Set("sku_ids", strings.Join(filterOptions.SkuIDs, ","))
}
if filterOptions.BeforeID != "" {
queryParams.Set("before", filterOptions.BeforeID)
if filterOptions.Before != nil {
queryParams.Set("before", filterOptions.Before.Format(time.RFC3339))
}
if filterOptions.AfterID != "" {
queryParams.Set("after", filterOptions.AfterID)
if filterOptions.After != nil {
queryParams.Set("after", filterOptions.After.Format(time.RFC3339))
}
if filterOptions.Limit > 0 {
queryParams.Set("limit", strconv.Itoa(filterOptions.Limit))
Expand Down
14 changes: 7 additions & 7 deletions structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2506,7 +2506,7 @@ type Entitlement struct {

// The ID of the user that is granted access to the entitlement's sku
// Only available for user subscriptions.
UserID string `json:"user_id,omitempty"`
UserID *string `json:"user_id,omitempty"`

// The type of the entitlement
Type EntitlementType `json:"type"`
Expand All @@ -2524,11 +2524,11 @@ type Entitlement struct {

// The ID of the guild that is granted access to the entitlement's sku.
// Only available for guild subscriptions.
GuildID string `json:"guild_id,omitempty"`
GuildID *string `json:"guild_id,omitempty"`

// Whether or not the entitlement has been consumed.
// Only available for consumable items.
Consumed bool `json:"consumed,omitempty"`
Consumed *bool `json:"consumed,omitempty"`

// The SubscriptionID of the entitlement.
// Not present when using test entitlements.
Expand Down Expand Up @@ -2564,11 +2564,11 @@ type EntitlementFilterOptions struct {
// Optional array of SKU IDs to check for.
SkuIDs []string

// Optional timestamp (snowflake) to retrieve Entitlements before this time.
BeforeID string
// Optional timestamp to retrieve Entitlements before this time.
Before *time.Time

// Optional timestamp (snowflake) to retrieve Entitlements after this time.
AfterID string
// Optional timestamp to retrieve Entitlements after this time.
After *time.Time

// Optional maximum number of entitlements to return (1-100, default 100).
Limit int
Expand Down

0 comments on commit d9d9f4b

Please sign in to comment.