dodopayments 2.9.0 → 2.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +23 -0
  3. data/README.md +1 -1
  4. data/lib/dodopayments/internal/transport/base_client.rb +2 -0
  5. data/lib/dodopayments/internal/type/union.rb +21 -7
  6. data/lib/dodopayments/models/abandoned_checkout_detected_webhook_event.rb +4 -16
  7. data/lib/dodopayments/models/abandoned_checkout_recovered_webhook_event.rb +4 -16
  8. data/lib/dodopayments/models/checkout_session_request.rb +15 -2
  9. data/lib/dodopayments/models/credit_added_webhook_event.rb +4 -16
  10. data/lib/dodopayments/models/credit_balance_low_webhook_event.rb +4 -16
  11. data/lib/dodopayments/models/credit_deducted_webhook_event.rb +4 -16
  12. data/lib/dodopayments/models/credit_expired_webhook_event.rb +4 -16
  13. data/lib/dodopayments/models/credit_manual_adjustment_webhook_event.rb +4 -16
  14. data/lib/dodopayments/models/credit_overage_charged_webhook_event.rb +4 -16
  15. data/lib/dodopayments/models/credit_overage_reset_webhook_event.rb +4 -16
  16. data/lib/dodopayments/models/credit_rolled_over_webhook_event.rb +4 -16
  17. data/lib/dodopayments/models/credit_rollover_forfeited_webhook_event.rb +4 -16
  18. data/lib/dodopayments/models/digital_product_delivery.rb +14 -7
  19. data/lib/dodopayments/models/digital_product_delivery_file.rb +12 -5
  20. data/lib/dodopayments/models/dispute_accepted_webhook_event.rb +4 -16
  21. data/lib/dodopayments/models/dispute_cancelled_webhook_event.rb +4 -16
  22. data/lib/dodopayments/models/dispute_challenged_webhook_event.rb +4 -16
  23. data/lib/dodopayments/models/dispute_expired_webhook_event.rb +4 -16
  24. data/lib/dodopayments/models/dispute_lost_webhook_event.rb +4 -16
  25. data/lib/dodopayments/models/dispute_opened_webhook_event.rb +4 -16
  26. data/lib/dodopayments/models/dispute_won_webhook_event.rb +4 -16
  27. data/lib/dodopayments/models/dunning_recovered_webhook_event.rb +4 -16
  28. data/lib/dodopayments/models/dunning_started_webhook_event.rb +4 -16
  29. data/lib/dodopayments/models/entitlement.rb +31 -20
  30. data/lib/dodopayments/models/entitlement_create_params.rb +3 -3
  31. data/lib/dodopayments/models/entitlement_grant_created_webhook_event.rb +10 -17
  32. data/lib/dodopayments/models/entitlement_grant_delivered_webhook_event.rb +10 -17
  33. data/lib/dodopayments/models/entitlement_grant_failed_webhook_event.rb +10 -17
  34. data/lib/dodopayments/models/entitlement_grant_revoked_webhook_event.rb +10 -17
  35. data/lib/dodopayments/models/entitlement_update_params.rb +3 -3
  36. data/lib/dodopayments/models/entitlements/entitlement_grant.rb +50 -32
  37. data/lib/dodopayments/models/entitlements/file_upload_response.rb +3 -3
  38. data/lib/dodopayments/models/entitlements/license_key_grant.rb +14 -9
  39. data/lib/dodopayments/models/integration_config.rb +70 -27
  40. data/lib/dodopayments/models/integration_config_response.rb +88 -48
  41. data/lib/dodopayments/models/license_key_created_webhook_event.rb +4 -16
  42. data/lib/dodopayments/models/payment.rb +153 -3
  43. data/lib/dodopayments/models/payment_cancelled_webhook_event.rb +4 -16
  44. data/lib/dodopayments/models/payment_create_params.rb +15 -3
  45. data/lib/dodopayments/models/payment_create_response.rb +14 -3
  46. data/lib/dodopayments/models/payment_failed_webhook_event.rb +4 -16
  47. data/lib/dodopayments/models/payment_processing_webhook_event.rb +4 -16
  48. data/lib/dodopayments/models/payment_succeeded_webhook_event.rb +4 -16
  49. data/lib/dodopayments/models/payout_list_response.rb +6 -3
  50. data/lib/dodopayments/models/price.rb +20 -48
  51. data/lib/dodopayments/models/product.rb +6 -8
  52. data/lib/dodopayments/models/product_create_params.rb +3 -3
  53. data/lib/dodopayments/models/product_entitlement_summary.rb +5 -5
  54. data/lib/dodopayments/models/product_item_req.rb +42 -1
  55. data/lib/dodopayments/models/product_update_params.rb +3 -3
  56. data/lib/dodopayments/models/refund_failed_webhook_event.rb +4 -16
  57. data/lib/dodopayments/models/refund_succeeded_webhook_event.rb +4 -16
  58. data/lib/dodopayments/models/subscription.rb +153 -5
  59. data/lib/dodopayments/models/subscription_active_webhook_event.rb +4 -16
  60. data/lib/dodopayments/models/subscription_cancelled_webhook_event.rb +4 -16
  61. data/lib/dodopayments/models/subscription_create_params.rb +15 -3
  62. data/lib/dodopayments/models/subscription_create_response.rb +14 -3
  63. data/lib/dodopayments/models/subscription_expired_webhook_event.rb +4 -16
  64. data/lib/dodopayments/models/subscription_failed_webhook_event.rb +4 -16
  65. data/lib/dodopayments/models/subscription_list_response.rb +36 -5
  66. data/lib/dodopayments/models/subscription_on_hold_webhook_event.rb +4 -16
  67. data/lib/dodopayments/models/subscription_plan_changed_webhook_event.rb +4 -16
  68. data/lib/dodopayments/models/subscription_preview_change_plan_response.rb +21 -49
  69. data/lib/dodopayments/models/subscription_renewed_webhook_event.rb +4 -16
  70. data/lib/dodopayments/models/subscription_update_payment_method_params.rb +12 -30
  71. data/lib/dodopayments/models/subscription_updated_webhook_event.rb +4 -16
  72. data/lib/dodopayments/models/unsafe_unwrap_webhook_event.rb +41 -39
  73. data/lib/dodopayments/models/unwrap_webhook_event.rb +41 -39
  74. data/lib/dodopayments/models/update_subscription_plan_req.rb +17 -6
  75. data/lib/dodopayments/models/webhook_event_type.rb +3 -0
  76. data/lib/dodopayments/models/webhook_payload.rb +57 -143
  77. data/lib/dodopayments/resources/checkout_sessions.rb +8 -4
  78. data/lib/dodopayments/resources/entitlements/files.rb +3 -10
  79. data/lib/dodopayments/resources/entitlements/grants.rb +2 -4
  80. data/lib/dodopayments/resources/entitlements.rb +2 -2
  81. data/lib/dodopayments/resources/payments.rb +4 -2
  82. data/lib/dodopayments/resources/subscriptions.rb +12 -6
  83. data/lib/dodopayments/version.rb +1 -1
  84. data/rbi/dodopayments/models/abandoned_checkout_detected_webhook_event.rbi +4 -40
  85. data/rbi/dodopayments/models/abandoned_checkout_recovered_webhook_event.rbi +4 -40
  86. data/rbi/dodopayments/models/checkout_session_request.rbi +14 -0
  87. data/rbi/dodopayments/models/credit_added_webhook_event.rbi +4 -29
  88. data/rbi/dodopayments/models/credit_balance_low_webhook_event.rbi +4 -33
  89. data/rbi/dodopayments/models/credit_deducted_webhook_event.rbi +4 -33
  90. data/rbi/dodopayments/models/credit_expired_webhook_event.rbi +4 -33
  91. data/rbi/dodopayments/models/credit_manual_adjustment_webhook_event.rbi +4 -39
  92. data/rbi/dodopayments/models/credit_overage_charged_webhook_event.rbi +4 -36
  93. data/rbi/dodopayments/models/credit_overage_reset_webhook_event.rbi +4 -36
  94. data/rbi/dodopayments/models/credit_rolled_over_webhook_event.rbi +4 -33
  95. data/rbi/dodopayments/models/credit_rollover_forfeited_webhook_event.rbi +4 -40
  96. data/rbi/dodopayments/models/digital_product_delivery.rbi +15 -5
  97. data/rbi/dodopayments/models/digital_product_delivery_file.rbi +11 -0
  98. data/rbi/dodopayments/models/dispute_accepted_webhook_event.rbi +4 -33
  99. data/rbi/dodopayments/models/dispute_cancelled_webhook_event.rbi +4 -33
  100. data/rbi/dodopayments/models/dispute_challenged_webhook_event.rbi +4 -34
  101. data/rbi/dodopayments/models/dispute_expired_webhook_event.rbi +4 -33
  102. data/rbi/dodopayments/models/dispute_lost_webhook_event.rbi +4 -29
  103. data/rbi/dodopayments/models/dispute_opened_webhook_event.rbi +4 -33
  104. data/rbi/dodopayments/models/dispute_won_webhook_event.rbi +4 -29
  105. data/rbi/dodopayments/models/dunning_recovered_webhook_event.rbi +4 -33
  106. data/rbi/dodopayments/models/dunning_started_webhook_event.rbi +4 -33
  107. data/rbi/dodopayments/models/entitlement.rbi +35 -20
  108. data/rbi/dodopayments/models/entitlement_create_params.rbi +8 -5
  109. data/rbi/dodopayments/models/entitlement_grant_created_webhook_event.rbi +8 -40
  110. data/rbi/dodopayments/models/entitlement_grant_delivered_webhook_event.rbi +8 -40
  111. data/rbi/dodopayments/models/entitlement_grant_failed_webhook_event.rbi +8 -39
  112. data/rbi/dodopayments/models/entitlement_grant_revoked_webhook_event.rbi +8 -40
  113. data/rbi/dodopayments/models/entitlement_update_params.rbi +4 -4
  114. data/rbi/dodopayments/models/entitlements/entitlement_grant.rbi +54 -20
  115. data/rbi/dodopayments/models/entitlements/file_upload_response.rbi +4 -4
  116. data/rbi/dodopayments/models/entitlements/license_key_grant.rbi +10 -4
  117. data/rbi/dodopayments/models/integration_config.rbi +141 -26
  118. data/rbi/dodopayments/models/integration_config_response.rbi +153 -38
  119. data/rbi/dodopayments/models/license_key_created_webhook_event.rbi +4 -34
  120. data/rbi/dodopayments/models/payment.rbi +170 -2
  121. data/rbi/dodopayments/models/payment_cancelled_webhook_event.rbi +4 -33
  122. data/rbi/dodopayments/models/payment_create_params.rbi +14 -2
  123. data/rbi/dodopayments/models/payment_create_response.rbi +12 -2
  124. data/rbi/dodopayments/models/payment_failed_webhook_event.rbi +4 -33
  125. data/rbi/dodopayments/models/payment_processing_webhook_event.rbi +4 -34
  126. data/rbi/dodopayments/models/payment_succeeded_webhook_event.rbi +4 -33
  127. data/rbi/dodopayments/models/price.rbi +18 -90
  128. data/rbi/dodopayments/models/product.rbi +4 -8
  129. data/rbi/dodopayments/models/product_entitlement_summary.rbi +8 -8
  130. data/rbi/dodopayments/models/product_item_req.rbi +74 -3
  131. data/rbi/dodopayments/models/refund_failed_webhook_event.rbi +4 -31
  132. data/rbi/dodopayments/models/refund_succeeded_webhook_event.rbi +4 -33
  133. data/rbi/dodopayments/models/subscription.rbi +173 -4
  134. data/rbi/dodopayments/models/subscription_active_webhook_event.rbi +4 -36
  135. data/rbi/dodopayments/models/subscription_cancelled_webhook_event.rbi +4 -36
  136. data/rbi/dodopayments/models/subscription_create_params.rbi +14 -2
  137. data/rbi/dodopayments/models/subscription_create_response.rbi +12 -2
  138. data/rbi/dodopayments/models/subscription_expired_webhook_event.rbi +4 -36
  139. data/rbi/dodopayments/models/subscription_failed_webhook_event.rbi +4 -36
  140. data/rbi/dodopayments/models/subscription_list_response.rbi +67 -4
  141. data/rbi/dodopayments/models/subscription_on_hold_webhook_event.rbi +4 -36
  142. data/rbi/dodopayments/models/subscription_plan_changed_webhook_event.rbi +4 -40
  143. data/rbi/dodopayments/models/subscription_preview_change_plan_response.rbi +18 -123
  144. data/rbi/dodopayments/models/subscription_renewed_webhook_event.rbi +4 -36
  145. data/rbi/dodopayments/models/subscription_update_payment_method_params.rbi +12 -96
  146. data/rbi/dodopayments/models/subscription_updated_webhook_event.rbi +4 -36
  147. data/rbi/dodopayments/models/update_subscription_plan_req.rbi +18 -8
  148. data/rbi/dodopayments/models/webhook_event_type.rbi +15 -0
  149. data/rbi/dodopayments/models/webhook_payload.rbi +48 -466
  150. data/rbi/dodopayments/resources/checkout_sessions.rbi +12 -0
  151. data/rbi/dodopayments/resources/entitlements/files.rbi +3 -10
  152. data/rbi/dodopayments/resources/entitlements/grants.rbi +2 -4
  153. data/rbi/dodopayments/resources/entitlements.rbi +4 -4
  154. data/rbi/dodopayments/resources/payments.rbi +6 -1
  155. data/rbi/dodopayments/resources/subscriptions.rbi +22 -9
  156. data/sig/dodopayments/models/abandoned_checkout_detected_webhook_event.rbs +4 -14
  157. data/sig/dodopayments/models/abandoned_checkout_recovered_webhook_event.rbs +4 -14
  158. data/sig/dodopayments/models/checkout_session_request.rbs +5 -0
  159. data/sig/dodopayments/models/credit_added_webhook_event.rbs +4 -14
  160. data/sig/dodopayments/models/credit_balance_low_webhook_event.rbs +4 -14
  161. data/sig/dodopayments/models/credit_deducted_webhook_event.rbs +4 -14
  162. data/sig/dodopayments/models/credit_expired_webhook_event.rbs +4 -14
  163. data/sig/dodopayments/models/credit_manual_adjustment_webhook_event.rbs +4 -14
  164. data/sig/dodopayments/models/credit_overage_charged_webhook_event.rbs +4 -14
  165. data/sig/dodopayments/models/credit_overage_reset_webhook_event.rbs +4 -14
  166. data/sig/dodopayments/models/credit_rolled_over_webhook_event.rbs +4 -14
  167. data/sig/dodopayments/models/credit_rollover_forfeited_webhook_event.rbs +4 -14
  168. data/sig/dodopayments/models/dispute_accepted_webhook_event.rbs +4 -14
  169. data/sig/dodopayments/models/dispute_cancelled_webhook_event.rbs +4 -14
  170. data/sig/dodopayments/models/dispute_challenged_webhook_event.rbs +4 -14
  171. data/sig/dodopayments/models/dispute_expired_webhook_event.rbs +4 -14
  172. data/sig/dodopayments/models/dispute_lost_webhook_event.rbs +4 -14
  173. data/sig/dodopayments/models/dispute_opened_webhook_event.rbs +4 -14
  174. data/sig/dodopayments/models/dispute_won_webhook_event.rbs +4 -14
  175. data/sig/dodopayments/models/dunning_recovered_webhook_event.rbs +4 -14
  176. data/sig/dodopayments/models/dunning_started_webhook_event.rbs +4 -14
  177. data/sig/dodopayments/models/entitlement.rbs +8 -10
  178. data/sig/dodopayments/models/entitlement_create_params.rbs +6 -4
  179. data/sig/dodopayments/models/entitlement_grant_created_webhook_event.rbs +4 -14
  180. data/sig/dodopayments/models/entitlement_grant_delivered_webhook_event.rbs +4 -14
  181. data/sig/dodopayments/models/entitlement_grant_failed_webhook_event.rbs +4 -14
  182. data/sig/dodopayments/models/entitlement_grant_revoked_webhook_event.rbs +4 -14
  183. data/sig/dodopayments/models/entitlements/entitlement_grant.rbs +4 -11
  184. data/sig/dodopayments/models/integration_config.rbs +28 -4
  185. data/sig/dodopayments/models/integration_config_response.rbs +28 -9
  186. data/sig/dodopayments/models/license_key_created_webhook_event.rbs +4 -14
  187. data/sig/dodopayments/models/payment.rbs +97 -0
  188. data/sig/dodopayments/models/payment_cancelled_webhook_event.rbs +4 -14
  189. data/sig/dodopayments/models/payment_create_params.rbs +5 -0
  190. data/sig/dodopayments/models/payment_create_response.rbs +5 -0
  191. data/sig/dodopayments/models/payment_failed_webhook_event.rbs +4 -14
  192. data/sig/dodopayments/models/payment_processing_webhook_event.rbs +4 -14
  193. data/sig/dodopayments/models/payment_succeeded_webhook_event.rbs +4 -14
  194. data/sig/dodopayments/models/price.rbs +15 -45
  195. data/sig/dodopayments/models/product_item_req.rbs +27 -3
  196. data/sig/dodopayments/models/refund_failed_webhook_event.rbs +4 -14
  197. data/sig/dodopayments/models/refund_succeeded_webhook_event.rbs +4 -14
  198. data/sig/dodopayments/models/subscription.rbs +97 -0
  199. data/sig/dodopayments/models/subscription_active_webhook_event.rbs +4 -14
  200. data/sig/dodopayments/models/subscription_cancelled_webhook_event.rbs +4 -14
  201. data/sig/dodopayments/models/subscription_create_params.rbs +5 -0
  202. data/sig/dodopayments/models/subscription_create_response.rbs +5 -0
  203. data/sig/dodopayments/models/subscription_expired_webhook_event.rbs +4 -14
  204. data/sig/dodopayments/models/subscription_failed_webhook_event.rbs +4 -14
  205. data/sig/dodopayments/models/subscription_list_response.rbs +24 -0
  206. data/sig/dodopayments/models/subscription_on_hold_webhook_event.rbs +4 -14
  207. data/sig/dodopayments/models/subscription_plan_changed_webhook_event.rbs +4 -14
  208. data/sig/dodopayments/models/subscription_preview_change_plan_response.rbs +15 -45
  209. data/sig/dodopayments/models/subscription_renewed_webhook_event.rbs +4 -14
  210. data/sig/dodopayments/models/subscription_update_payment_method_params.rbs +8 -48
  211. data/sig/dodopayments/models/subscription_updated_webhook_event.rbs +4 -14
  212. data/sig/dodopayments/models/update_subscription_plan_req.rbs +5 -0
  213. data/sig/dodopayments/models/webhook_event_type.rbs +6 -0
  214. data/sig/dodopayments/models/webhook_payload.rbs +50 -213
  215. data/sig/dodopayments/resources/checkout_sessions.rbs +2 -0
  216. data/sig/dodopayments/resources/entitlements.rbs +1 -1
  217. data/sig/dodopayments/resources/payments.rbs +1 -0
  218. data/sig/dodopayments/resources/subscriptions.rbs +3 -0
  219. metadata +2 -2
@@ -18,8 +18,8 @@ module Dodopayments
18
18
  optional :description, String, nil?: true
19
19
 
20
20
  # @!attribute integration_config
21
- # Platform-specific configuration for an entitlement. Each variant uses unique
22
- # field names so `#[serde(untagged)]` can disambiguate correctly.
21
+ # Integration-specific configuration supplied when creating or updating an
22
+ # entitlement. The shape required matches the entitlement's `integration_type`.
23
23
  #
24
24
  # @return [Dodopayments::Models::IntegrationConfig::GitHubConfig, Dodopayments::Models::IntegrationConfig::DiscordConfig, Dodopayments::Models::IntegrationConfig::TelegramConfig, Dodopayments::Models::IntegrationConfig::FigmaConfig, Dodopayments::Models::IntegrationConfig::FramerConfig, Dodopayments::Models::IntegrationConfig::NotionConfig, Dodopayments::Models::IntegrationConfig::DigitalFilesConfig, Dodopayments::Models::IntegrationConfig::LicenseKeyConfig, nil]
25
25
  optional :integration_config, union: -> { Dodopayments::IntegrationConfig }, nil?: true
@@ -42,7 +42,7 @@ module Dodopayments
42
42
  #
43
43
  # @param description [String, nil]
44
44
  #
45
- # @param integration_config [Dodopayments::Models::IntegrationConfig::GitHubConfig, Dodopayments::Models::IntegrationConfig::DiscordConfig, Dodopayments::Models::IntegrationConfig::TelegramConfig, Dodopayments::Models::IntegrationConfig::FigmaConfig, Dodopayments::Models::IntegrationConfig::FramerConfig, Dodopayments::Models::IntegrationConfig::NotionConfig, Dodopayments::Models::IntegrationConfig::DigitalFilesConfig, Dodopayments::Models::IntegrationConfig::LicenseKeyConfig, nil] Platform-specific configuration for an entitlement.
45
+ # @param integration_config [Dodopayments::Models::IntegrationConfig::GitHubConfig, Dodopayments::Models::IntegrationConfig::DiscordConfig, Dodopayments::Models::IntegrationConfig::TelegramConfig, Dodopayments::Models::IntegrationConfig::FigmaConfig, Dodopayments::Models::IntegrationConfig::FramerConfig, Dodopayments::Models::IntegrationConfig::NotionConfig, Dodopayments::Models::IntegrationConfig::DigitalFilesConfig, Dodopayments::Models::IntegrationConfig::LicenseKeyConfig, nil] Integration-specific configuration supplied when creating or updating
46
46
  #
47
47
  # @param metadata [Hash{Symbol=>String}, nil]
48
48
  #
@@ -6,152 +6,170 @@ module Dodopayments
6
6
  # @see Dodopayments::Resources::Entitlements::Grants#list
7
7
  class EntitlementGrant < Dodopayments::Internal::Type::BaseModel
8
8
  # @!attribute id
9
+ # Unique identifier of the grant.
9
10
  #
10
11
  # @return [String]
11
12
  required :id, String
12
13
 
13
14
  # @!attribute business_id
15
+ # Identifier of the business that owns the grant.
14
16
  #
15
17
  # @return [String]
16
18
  required :business_id, String
17
19
 
18
20
  # @!attribute created_at
21
+ # Timestamp when the grant was created.
19
22
  #
20
23
  # @return [Time]
21
24
  required :created_at, Time
22
25
 
23
26
  # @!attribute customer_id
27
+ # Identifier of the customer the grant was issued to.
24
28
  #
25
29
  # @return [String]
26
30
  required :customer_id, String
27
31
 
28
32
  # @!attribute entitlement_id
33
+ # Identifier of the entitlement this grant was issued from.
29
34
  #
30
35
  # @return [String]
31
36
  required :entitlement_id, String
32
37
 
33
- # @!attribute external_id
38
+ # @!attribute metadata
39
+ # Arbitrary key-value metadata recorded on the grant.
34
40
  #
35
- # @return [String]
36
- required :external_id, String
41
+ # @return [Hash{Symbol=>String}]
42
+ required :metadata, Dodopayments::Internal::Type::HashOf[String]
37
43
 
38
44
  # @!attribute status
45
+ # Lifecycle status of the grant.
39
46
  #
40
47
  # @return [Symbol, Dodopayments::Models::Entitlements::EntitlementGrant::Status]
41
48
  required :status, enum: -> { Dodopayments::Entitlements::EntitlementGrant::Status }
42
49
 
43
50
  # @!attribute updated_at
51
+ # Timestamp when the grant was last modified.
44
52
  #
45
53
  # @return [Time]
46
54
  required :updated_at, Time
47
55
 
48
56
  # @!attribute delivered_at
57
+ # Timestamp when the grant transitioned to `delivered`, when applicable.
49
58
  #
50
59
  # @return [Time, nil]
51
60
  optional :delivered_at, Time, nil?: true
52
61
 
53
62
  # @!attribute digital_product_delivery
54
- # Present only when the entitlement integration_type is `digital_files`. Populated
55
- # eagerly on every list and single-record endpoint.
63
+ # Digital-product-delivery payload, present when the entitlement integration is
64
+ # `digital_files`.
56
65
  #
57
66
  # @return [Dodopayments::Models::DigitalProductDelivery, nil]
58
67
  optional :digital_product_delivery, -> { Dodopayments::DigitalProductDelivery }, nil?: true
59
68
 
60
69
  # @!attribute error_code
70
+ # Machine-readable code reported when delivery failed, when applicable.
61
71
  #
62
72
  # @return [String, nil]
63
73
  optional :error_code, String, nil?: true
64
74
 
65
75
  # @!attribute error_message
76
+ # Human-readable message reported when delivery failed, when applicable.
66
77
  #
67
78
  # @return [String, nil]
68
79
  optional :error_message, String, nil?: true
69
80
 
70
81
  # @!attribute license_key
71
- # Present only when the entitlement integration_type is `license_key`.
82
+ # License-key delivery payload, present when the entitlement integration is
83
+ # `license_key`.
72
84
  #
73
85
  # @return [Dodopayments::Models::Entitlements::LicenseKeyGrant, nil]
74
86
  optional :license_key, -> { Dodopayments::Entitlements::LicenseKeyGrant }, nil?: true
75
87
 
76
- # @!attribute metadata
77
- #
78
- # @return [Object, nil]
79
- optional :metadata, Dodopayments::Internal::Type::Unknown
80
-
81
88
  # @!attribute oauth_expires_at
89
+ # Timestamp when `oauth_url` stops being valid, when applicable.
82
90
  #
83
91
  # @return [Time, nil]
84
92
  optional :oauth_expires_at, Time, nil?: true
85
93
 
86
94
  # @!attribute oauth_url
95
+ # Customer-facing OAuth URL for OAuth-style integrations. Populated during the
96
+ # customer-portal accept flow; `null` until the customer completes that step, and
97
+ # on grants for non-OAuth integrations.
87
98
  #
88
99
  # @return [String, nil]
89
100
  optional :oauth_url, String, nil?: true
90
101
 
91
102
  # @!attribute payment_id
103
+ # Identifier of the payment that triggered this grant, when applicable.
92
104
  #
93
105
  # @return [String, nil]
94
106
  optional :payment_id, String, nil?: true
95
107
 
96
108
  # @!attribute revocation_reason
109
+ # Reason recorded when the grant was revoked, when applicable.
97
110
  #
98
111
  # @return [String, nil]
99
112
  optional :revocation_reason, String, nil?: true
100
113
 
101
114
  # @!attribute revoked_at
115
+ # Timestamp when the grant transitioned to `revoked`, when applicable.
102
116
  #
103
117
  # @return [Time, nil]
104
118
  optional :revoked_at, Time, nil?: true
105
119
 
106
120
  # @!attribute subscription_id
121
+ # Identifier of the subscription that triggered this grant, when applicable.
107
122
  #
108
123
  # @return [String, nil]
109
124
  optional :subscription_id, String, nil?: true
110
125
 
111
- # @!method initialize(id:, business_id:, created_at:, customer_id:, entitlement_id:, external_id:, status:, updated_at:, delivered_at: nil, digital_product_delivery: nil, error_code: nil, error_message: nil, license_key: nil, metadata: nil, oauth_expires_at: nil, oauth_url: nil, payment_id: nil, revocation_reason: nil, revoked_at: nil, subscription_id: nil)
126
+ # @!method initialize(id:, business_id:, created_at:, customer_id:, entitlement_id:, metadata:, status:, updated_at:, delivered_at: nil, digital_product_delivery: nil, error_code: nil, error_message: nil, license_key: nil, oauth_expires_at: nil, oauth_url: nil, payment_id: nil, revocation_reason: nil, revoked_at: nil, subscription_id: nil)
112
127
  # Some parameter documentations has been truncated, see
113
128
  # {Dodopayments::Models::Entitlements::EntitlementGrant} for more details.
114
129
  #
115
- # @param id [String]
130
+ # Detailed view of a single entitlement grant: who it's for, its lifecycle state,
131
+ # and any integration-specific delivery payload.
116
132
  #
117
- # @param business_id [String]
133
+ # @param id [String] Unique identifier of the grant.
118
134
  #
119
- # @param created_at [Time]
135
+ # @param business_id [String] Identifier of the business that owns the grant.
120
136
  #
121
- # @param customer_id [String]
137
+ # @param created_at [Time] Timestamp when the grant was created.
122
138
  #
123
- # @param entitlement_id [String]
139
+ # @param customer_id [String] Identifier of the customer the grant was issued to.
124
140
  #
125
- # @param external_id [String]
141
+ # @param entitlement_id [String] Identifier of the entitlement this grant was issued from.
126
142
  #
127
- # @param status [Symbol, Dodopayments::Models::Entitlements::EntitlementGrant::Status]
143
+ # @param metadata [Hash{Symbol=>String}] Arbitrary key-value metadata recorded on the grant.
128
144
  #
129
- # @param updated_at [Time]
145
+ # @param status [Symbol, Dodopayments::Models::Entitlements::EntitlementGrant::Status] Lifecycle status of the grant.
130
146
  #
131
- # @param delivered_at [Time, nil]
147
+ # @param updated_at [Time] Timestamp when the grant was last modified.
132
148
  #
133
- # @param digital_product_delivery [Dodopayments::Models::DigitalProductDelivery, nil] Present only when the entitlement integration_type is `digital_files`.
149
+ # @param delivered_at [Time, nil] Timestamp when the grant transitioned to `delivered`, when applicable.
134
150
  #
135
- # @param error_code [String, nil]
151
+ # @param digital_product_delivery [Dodopayments::Models::DigitalProductDelivery, nil] Digital-product-delivery payload, present when the entitlement
136
152
  #
137
- # @param error_message [String, nil]
153
+ # @param error_code [String, nil] Machine-readable code reported when delivery failed, when applicable.
138
154
  #
139
- # @param license_key [Dodopayments::Models::Entitlements::LicenseKeyGrant, nil] Present only when the entitlement integration_type is `license_key`.
155
+ # @param error_message [String, nil] Human-readable message reported when delivery failed, when applicable.
140
156
  #
141
- # @param metadata [Object]
157
+ # @param license_key [Dodopayments::Models::Entitlements::LicenseKeyGrant, nil] License-key delivery payload, present when the entitlement integration
142
158
  #
143
- # @param oauth_expires_at [Time, nil]
159
+ # @param oauth_expires_at [Time, nil] Timestamp when `oauth_url` stops being valid, when applicable.
144
160
  #
145
- # @param oauth_url [String, nil]
161
+ # @param oauth_url [String, nil] Customer-facing OAuth URL for OAuth-style integrations. Populated
146
162
  #
147
- # @param payment_id [String, nil]
163
+ # @param payment_id [String, nil] Identifier of the payment that triggered this grant, when applicable.
148
164
  #
149
- # @param revocation_reason [String, nil]
165
+ # @param revocation_reason [String, nil] Reason recorded when the grant was revoked, when applicable.
150
166
  #
151
- # @param revoked_at [Time, nil]
167
+ # @param revoked_at [Time, nil] Timestamp when the grant transitioned to `revoked`, when applicable.
152
168
  #
153
- # @param subscription_id [String, nil]
169
+ # @param subscription_id [String, nil] Identifier of the subscription that triggered this grant, when applicable.
154
170
 
171
+ # Lifecycle status of the grant.
172
+ #
155
173
  # @see Dodopayments::Models::Entitlements::EntitlementGrant#status
156
174
  module Status
157
175
  extend Dodopayments::Internal::Type::Enum
@@ -6,8 +6,8 @@ module Dodopayments
6
6
  # @see Dodopayments::Resources::Entitlements::Files#upload
7
7
  class FileUploadResponse < Dodopayments::Internal::Type::BaseModel
8
8
  # @!attribute file_id
9
- # EE-issued digital file id; appended to
10
- # `entitlements.integration_config.digital_file_ids`.
9
+ # Identifier of the attached file. Pass it to
10
+ # `DELETE /entitlements/{id}/files/{file_id}` to detach the file later.
11
11
  #
12
12
  # @return [String]
13
13
  required :file_id, String
@@ -16,7 +16,7 @@ module Dodopayments
16
16
  # Some parameter documentations has been truncated, see
17
17
  # {Dodopayments::Models::Entitlements::FileUploadResponse} for more details.
18
18
  #
19
- # @param file_id [String] EE-issued digital file id; appended to
19
+ # @param file_id [String] Identifier of the attached file. Pass it to
20
20
  end
21
21
  end
22
22
  end
@@ -5,35 +5,40 @@ module Dodopayments
5
5
  module Entitlements
6
6
  class LicenseKeyGrant < Dodopayments::Internal::Type::BaseModel
7
7
  # @!attribute activations_used
8
+ # Number of activations consumed so far.
8
9
  #
9
10
  # @return [Integer]
10
11
  required :activations_used, Integer
11
12
 
12
13
  # @!attribute key
14
+ # Issued license key.
13
15
  #
14
16
  # @return [String]
15
17
  required :key, String
16
18
 
17
19
  # @!attribute activations_limit
20
+ # Maximum activations allowed by the entitlement, when set.
18
21
  #
19
22
  # @return [Integer, nil]
20
23
  optional :activations_limit, Integer, nil?: true
21
24
 
22
25
  # @!attribute expires_at
26
+ # When the license key expires, when applicable.
23
27
  #
24
28
  # @return [Time, nil]
25
29
  optional :expires_at, Time, nil?: true
26
30
 
27
31
  # @!method initialize(activations_used:, key:, activations_limit: nil, expires_at: nil)
28
- # Nested representation of license-key grant fields. Present only when the grant's
29
- # entitlement has `integration_type = 'license_key'` and a row exists in
30
- # `license_keys`. The grant's top-level `status` is the source of truth for the
31
- # grant's lifecycle no per-license-key status is exposed here.
32
- #
33
- # @param activations_used [Integer]
34
- # @param key [String]
35
- # @param activations_limit [Integer, nil]
36
- # @param expires_at [Time, nil]
32
+ # License-key delivery payload, present on grants for `license_key` entitlements.
33
+ # The grant's top-level `status` is the source of truth for the grant's lifecycle.
34
+ #
35
+ # @param activations_used [Integer] Number of activations consumed so far.
36
+ #
37
+ # @param key [String] Issued license key.
38
+ #
39
+ # @param activations_limit [Integer, nil] Maximum activations allowed by the entitlement, when set.
40
+ #
41
+ # @param expires_at [Time, nil] When the license key expires, when applicable.
37
42
  end
38
43
  end
39
44
  end
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Dodopayments
4
4
  module Models
5
- # Platform-specific configuration for an entitlement. Each variant uses unique
6
- # field names so `#[serde(untagged)]` can disambiguate correctly.
5
+ # Integration-specific configuration supplied when creating or updating an
6
+ # entitlement. The shape required matches the entitlement's `integration_type`.
7
7
  module IntegrationConfig
8
8
  extend Dodopayments::Internal::Type::Union
9
9
 
@@ -25,103 +25,133 @@ module Dodopayments
25
25
 
26
26
  class GitHubConfig < Dodopayments::Internal::Type::BaseModel
27
27
  # @!attribute permission
28
- # One of: pull, push, admin, maintain, triage
28
+ # Permission to grant on the repository.
29
29
  #
30
- # @return [String]
31
- required :permission, String
30
+ # @return [Symbol, Dodopayments::Models::IntegrationConfig::GitHubConfig::Permission]
31
+ required :permission, enum: -> { Dodopayments::IntegrationConfig::GitHubConfig::Permission }
32
32
 
33
33
  # @!attribute target_id
34
+ # Repository or organisation slug to grant access to.
34
35
  #
35
36
  # @return [String]
36
37
  required :target_id, String
37
38
 
38
39
  # @!method initialize(permission:, target_id:)
39
- # @param permission [String] One of: pull, push, admin, maintain, triage
40
+ # @param permission [Symbol, Dodopayments::Models::IntegrationConfig::GitHubConfig::Permission] Permission to grant on the repository.
41
+ #
42
+ # @param target_id [String] Repository or organisation slug to grant access to.
43
+
44
+ # Permission to grant on the repository.
40
45
  #
41
- # @param target_id [String]
46
+ # @see Dodopayments::Models::IntegrationConfig::GitHubConfig#permission
47
+ module Permission
48
+ extend Dodopayments::Internal::Type::Enum
49
+
50
+ PULL = :pull
51
+ PUSH = :push
52
+ ADMIN = :admin
53
+ MAINTAIN = :maintain
54
+ TRIAGE = :triage
55
+
56
+ # @!method self.values
57
+ # @return [Array<Symbol>]
58
+ end
42
59
  end
43
60
 
44
61
  class DiscordConfig < Dodopayments::Internal::Type::BaseModel
45
62
  # @!attribute guild_id
63
+ # Discord guild (server) ID.
46
64
  #
47
65
  # @return [String]
48
66
  required :guild_id, String
49
67
 
50
68
  # @!attribute role_id
69
+ # Optional Discord role to assign within the guild.
51
70
  #
52
71
  # @return [String, nil]
53
72
  optional :role_id, String, nil?: true
54
73
 
55
74
  # @!method initialize(guild_id:, role_id: nil)
56
- # @param guild_id [String]
57
- # @param role_id [String, nil]
75
+ # @param guild_id [String] Discord guild (server) ID.
76
+ #
77
+ # @param role_id [String, nil] Optional Discord role to assign within the guild.
58
78
  end
59
79
 
60
80
  class TelegramConfig < Dodopayments::Internal::Type::BaseModel
61
81
  # @!attribute chat_id
82
+ # Telegram chat ID. For groups this is typically a negative integer.
62
83
  #
63
84
  # @return [String]
64
85
  required :chat_id, String
65
86
 
66
87
  # @!method initialize(chat_id:)
67
- # @param chat_id [String]
88
+ # @param chat_id [String] Telegram chat ID. For groups this is typically a negative integer.
68
89
  end
69
90
 
70
91
  class FigmaConfig < Dodopayments::Internal::Type::BaseModel
71
92
  # @!attribute figma_file_id
93
+ # Figma file identifier to grant access to.
72
94
  #
73
95
  # @return [String]
74
96
  required :figma_file_id, String
75
97
 
76
98
  # @!method initialize(figma_file_id:)
77
- # @param figma_file_id [String]
99
+ # @param figma_file_id [String] Figma file identifier to grant access to.
78
100
  end
79
101
 
80
102
  class FramerConfig < Dodopayments::Internal::Type::BaseModel
81
103
  # @!attribute framer_template_id
104
+ # Framer template identifier to grant access to.
82
105
  #
83
106
  # @return [String]
84
107
  required :framer_template_id, String
85
108
 
86
109
  # @!method initialize(framer_template_id:)
87
- # @param framer_template_id [String]
110
+ # @param framer_template_id [String] Framer template identifier to grant access to.
88
111
  end
89
112
 
90
113
  class NotionConfig < Dodopayments::Internal::Type::BaseModel
91
114
  # @!attribute notion_template_id
115
+ # Notion template identifier to grant access to.
92
116
  #
93
117
  # @return [String]
94
118
  required :notion_template_id, String
95
119
 
96
120
  # @!method initialize(notion_template_id:)
97
- # @param notion_template_id [String]
121
+ # @param notion_template_id [String] Notion template identifier to grant access to.
98
122
  end
99
123
 
100
124
  class DigitalFilesConfig < Dodopayments::Internal::Type::BaseModel
101
125
  # @!attribute digital_file_ids
126
+ # Files attached to this entitlement. Add files via
127
+ # `POST /entitlements/{id}/files` and remove them via
128
+ # `DELETE /entitlements/{id}/files/{file_id}`.
102
129
  #
103
130
  # @return [Array<String>]
104
131
  required :digital_file_ids, Dodopayments::Internal::Type::ArrayOf[String]
105
132
 
106
133
  # @!attribute external_url
134
+ # Optional external URL shown to the customer alongside the files.
107
135
  #
108
136
  # @return [String, nil]
109
137
  optional :external_url, String, nil?: true
110
138
 
111
139
  # @!attribute instructions
140
+ # Optional human-readable delivery instructions shown to the customer alongside
141
+ # the files.
112
142
  #
113
143
  # @return [String, nil]
114
144
  optional :instructions, String, nil?: true
115
145
 
116
146
  # @!attribute legacy_file_ids
117
- # Three-way patchable field (mirrors the credit_entitlements pattern):
147
+ # Three-way patchable list of legacy file identifiers:
118
148
  #
119
- # - omitted → preserve persisted (`None`)
120
- # - `null` → clear (`Some(None)`)
121
- # - `[...]` → replace (`Some(Some(...))`)
149
+ # - omitted → preserve the current value
150
+ # - `null` → clear
151
+ # - `[...]` → replace
122
152
  #
123
- # On Create / storage we collapse "clear" and empty-array to `None` so the
124
- # persisted JSONB never carries a `null` legacy_file_ids key.
153
+ # On create, an omitted field, an explicit `null`, or an empty array all result in
154
+ # no legacy files attached.
125
155
  #
126
156
  # @return [Array<String>, nil]
127
157
  optional :legacy_file_ids, Dodopayments::Internal::Type::ArrayOf[String], nil?: true
@@ -130,41 +160,54 @@ module Dodopayments
130
160
  # Some parameter documentations has been truncated, see
131
161
  # {Dodopayments::Models::IntegrationConfig::DigitalFilesConfig} for more details.
132
162
  #
133
- # @param digital_file_ids [Array<String>]
163
+ # @param digital_file_ids [Array<String>] Files attached to this entitlement. Add files via
134
164
  #
135
- # @param external_url [String, nil]
165
+ # @param external_url [String, nil] Optional external URL shown to the customer alongside the files.
136
166
  #
137
- # @param instructions [String, nil]
167
+ # @param instructions [String, nil] Optional human-readable delivery instructions shown to the customer
138
168
  #
139
- # @param legacy_file_ids [Array<String>, nil] Three-way patchable field (mirrors the credit_entitlements pattern):
169
+ # @param legacy_file_ids [Array<String>, nil] Three-way patchable list of legacy file identifiers:
140
170
  end
141
171
 
142
172
  class LicenseKeyConfig < Dodopayments::Internal::Type::BaseModel
143
173
  # @!attribute activation_message
174
+ # Optional message displayed when a customer activates the license key (≤ 2500
175
+ # characters).
144
176
  #
145
177
  # @return [String, nil]
146
178
  optional :activation_message, String, nil?: true
147
179
 
148
180
  # @!attribute activations_limit
181
+ # Maximum activations allowed per issued license key. Omit for unlimited.
149
182
  #
150
183
  # @return [Integer, nil]
151
184
  optional :activations_limit, Integer, nil?: true
152
185
 
153
186
  # @!attribute duration_count
187
+ # Validity duration of issued license keys. Provide both `duration_count` and
188
+ # `duration_interval` together for a fixed duration; omit both for non-expiring
189
+ # keys.
154
190
  #
155
191
  # @return [Integer, nil]
156
192
  optional :duration_count, Integer, nil?: true
157
193
 
158
194
  # @!attribute duration_interval
195
+ # Unit of `duration_count`.
159
196
  #
160
197
  # @return [Symbol, Dodopayments::Models::TimeInterval, nil]
161
198
  optional :duration_interval, enum: -> { Dodopayments::TimeInterval }, nil?: true
162
199
 
163
200
  # @!method initialize(activation_message: nil, activations_limit: nil, duration_count: nil, duration_interval: nil)
164
- # @param activation_message [String, nil]
165
- # @param activations_limit [Integer, nil]
166
- # @param duration_count [Integer, nil]
167
- # @param duration_interval [Symbol, Dodopayments::Models::TimeInterval, nil]
201
+ # Some parameter documentations has been truncated, see
202
+ # {Dodopayments::Models::IntegrationConfig::LicenseKeyConfig} for more details.
203
+ #
204
+ # @param activation_message [String, nil] Optional message displayed when a customer activates the license
205
+ #
206
+ # @param activations_limit [Integer, nil] Maximum activations allowed per issued license key. Omit for unlimited.
207
+ #
208
+ # @param duration_count [Integer, nil] Validity duration of issued license keys. Provide both
209
+ #
210
+ # @param duration_interval [Symbol, Dodopayments::Models::TimeInterval, nil] Unit of `duration_count`.
168
211
  end
169
212
 
170
213
  # @!method self.variants