dodopayments 2.8.1 → 2.9.1

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 (195) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +17 -0
  3. data/README.md +1 -1
  4. data/lib/dodopayments/client.rb +4 -0
  5. data/lib/dodopayments/models/attach_product_entitlement.rb +22 -0
  6. data/lib/dodopayments/models/cancellation_feedback.rb +21 -0
  7. data/lib/dodopayments/models/checkout_session_flags.rb +12 -1
  8. data/lib/dodopayments/models/checkout_session_request.rb +14 -1
  9. data/lib/dodopayments/models/credit_entitlements/credit_ledger_entry.rb +1 -0
  10. data/lib/dodopayments/models/credit_overage_reset_webhook_event.rb +52 -0
  11. data/lib/dodopayments/models/customer_list_entitlements_params.rb +20 -0
  12. data/lib/dodopayments/models/customer_list_entitlements_response.rb +105 -0
  13. data/lib/dodopayments/models/digital_product_delivery.rb +19 -14
  14. data/lib/dodopayments/models/digital_product_delivery_file.rb +40 -9
  15. data/lib/dodopayments/models/entitlement.rb +97 -0
  16. data/lib/dodopayments/models/entitlement_create_params.rb +54 -0
  17. data/lib/dodopayments/models/entitlement_delete_params.rb +20 -0
  18. data/lib/dodopayments/models/entitlement_grant_created_webhook_event.rb +56 -0
  19. data/lib/dodopayments/models/entitlement_grant_delivered_webhook_event.rb +56 -0
  20. data/lib/dodopayments/models/entitlement_grant_failed_webhook_event.rb +56 -0
  21. data/lib/dodopayments/models/entitlement_grant_revoked_webhook_event.rb +56 -0
  22. data/lib/dodopayments/models/entitlement_integration_type.rb +21 -0
  23. data/lib/dodopayments/models/entitlement_list_params.rb +55 -0
  24. data/lib/dodopayments/models/entitlement_retrieve_params.rb +20 -0
  25. data/lib/dodopayments/models/entitlement_update_params.rb +54 -0
  26. data/lib/dodopayments/models/entitlements/entitlement_grant.rb +190 -0
  27. data/lib/dodopayments/models/entitlements/file_delete_params.rb +28 -0
  28. data/lib/dodopayments/models/entitlements/file_upload_params.rb +22 -0
  29. data/lib/dodopayments/models/entitlements/file_upload_response.rb +23 -0
  30. data/lib/dodopayments/models/entitlements/grant_list_params.rb +68 -0
  31. data/lib/dodopayments/models/entitlements/grant_revoke_params.rb +28 -0
  32. data/lib/dodopayments/models/entitlements/license_key_grant.rb +45 -0
  33. data/lib/dodopayments/models/integration_config.rb +217 -0
  34. data/lib/dodopayments/models/integration_config_response.rb +278 -0
  35. data/lib/dodopayments/models/license_key_instance_list_params.rb +9 -1
  36. data/lib/dodopayments/models/one_time_product_cart_item.rb +15 -1
  37. data/lib/dodopayments/models/payment.rb +19 -3
  38. data/lib/dodopayments/models/payment_create_params.rb +23 -35
  39. data/lib/dodopayments/models/payment_create_response.rb +3 -33
  40. data/lib/dodopayments/models/product.rb +10 -217
  41. data/lib/dodopayments/models/product_create_params.rb +25 -6
  42. data/lib/dodopayments/models/product_entitlement_summary.rb +57 -0
  43. data/lib/dodopayments/models/product_list_response.rb +3 -218
  44. data/lib/dodopayments/models/product_update_params.rb +21 -7
  45. data/lib/dodopayments/models/scheduled_plan_change.rb +99 -0
  46. data/lib/dodopayments/models/subscription.rb +20 -102
  47. data/lib/dodopayments/models/subscription_create_params.rb +27 -37
  48. data/lib/dodopayments/models/subscription_create_response.rb +19 -3
  49. data/lib/dodopayments/models/subscription_list_response.rb +3 -103
  50. data/lib/dodopayments/models/subscription_update_params.rb +23 -1
  51. data/lib/dodopayments/models/unsafe_unwrap_webhook_event.rb +11 -1
  52. data/lib/dodopayments/models/unwrap_webhook_event.rb +11 -1
  53. data/lib/dodopayments/models/update_subscription_plan_req.rb +10 -1
  54. data/lib/dodopayments/models/webhook_event_type.rb +1 -0
  55. data/lib/dodopayments/models/webhook_payload.rb +6 -153
  56. data/lib/dodopayments/models.rb +40 -0
  57. data/lib/dodopayments/resources/checkout_sessions.rb +6 -2
  58. data/lib/dodopayments/resources/customers.rb +20 -0
  59. data/lib/dodopayments/resources/entitlements/files.rb +63 -0
  60. data/lib/dodopayments/resources/entitlements/grants.rb +76 -0
  61. data/lib/dodopayments/resources/entitlements.rb +153 -0
  62. data/lib/dodopayments/resources/license_key_instances.rb +3 -1
  63. data/lib/dodopayments/resources/payments.rb +6 -2
  64. data/lib/dodopayments/resources/products.rb +4 -4
  65. data/lib/dodopayments/resources/subscriptions.rb +20 -5
  66. data/lib/dodopayments/resources/webhooks.rb +2 -2
  67. data/lib/dodopayments/version.rb +1 -1
  68. data/lib/dodopayments.rb +30 -0
  69. data/rbi/dodopayments/client.rbi +3 -0
  70. data/rbi/dodopayments/models/attach_product_entitlement.rbi +35 -0
  71. data/rbi/dodopayments/models/cancellation_feedback.rbi +45 -0
  72. data/rbi/dodopayments/models/checkout_session_flags.rbi +20 -3
  73. data/rbi/dodopayments/models/checkout_session_request.rbi +18 -0
  74. data/rbi/dodopayments/models/credit_entitlements/credit_ledger_entry.rbi +5 -0
  75. data/rbi/dodopayments/models/credit_overage_reset_webhook_event.rbi +103 -0
  76. data/rbi/dodopayments/models/customer_list_entitlements_params.rbi +38 -0
  77. data/rbi/dodopayments/models/customer_list_entitlements_response.rbi +189 -0
  78. data/rbi/dodopayments/models/digital_product_delivery.rbi +16 -18
  79. data/rbi/dodopayments/models/digital_product_delivery_file.rbi +51 -8
  80. data/rbi/dodopayments/models/entitlement.rbi +127 -0
  81. data/rbi/dodopayments/models/entitlement_create_params.rbi +115 -0
  82. data/rbi/dodopayments/models/entitlement_delete_params.rbi +38 -0
  83. data/rbi/dodopayments/models/entitlement_grant_created_webhook_event.rbi +107 -0
  84. data/rbi/dodopayments/models/entitlement_grant_delivered_webhook_event.rbi +107 -0
  85. data/rbi/dodopayments/models/entitlement_grant_failed_webhook_event.rbi +106 -0
  86. data/rbi/dodopayments/models/entitlement_grant_revoked_webhook_event.rbi +107 -0
  87. data/rbi/dodopayments/models/entitlement_integration_type.rbi +44 -0
  88. data/rbi/dodopayments/models/entitlement_list_params.rbi +146 -0
  89. data/rbi/dodopayments/models/entitlement_retrieve_params.rbi +38 -0
  90. data/rbi/dodopayments/models/entitlement_update_params.rbi +111 -0
  91. data/rbi/dodopayments/models/entitlements/entitlement_grant.rbi +269 -0
  92. data/rbi/dodopayments/models/entitlements/file_delete_params.rbi +48 -0
  93. data/rbi/dodopayments/models/entitlements/file_upload_params.rbi +40 -0
  94. data/rbi/dodopayments/models/entitlements/file_upload_response.rbi +34 -0
  95. data/rbi/dodopayments/models/entitlements/grant_list_params.rbi +145 -0
  96. data/rbi/dodopayments/models/entitlements/grant_revoke_params.rbi +48 -0
  97. data/rbi/dodopayments/models/entitlements/license_key_grant.rbi +68 -0
  98. data/rbi/dodopayments/models/integration_config.rbi +411 -0
  99. data/rbi/dodopayments/models/integration_config_response.rbi +531 -0
  100. data/rbi/dodopayments/models/license_key_instance_list_params.rbi +8 -0
  101. data/rbi/dodopayments/models/one_time_product_cart_item.rbi +24 -3
  102. data/rbi/dodopayments/models/payment.rbi +31 -3
  103. data/rbi/dodopayments/models/payment_create_params.rbi +28 -56
  104. data/rbi/dodopayments/models/payment_create_response.rbi +3 -68
  105. data/rbi/dodopayments/models/product.rbi +8 -420
  106. data/rbi/dodopayments/models/product_create_params.rbi +43 -7
  107. data/rbi/dodopayments/models/product_entitlement_summary.rbi +88 -0
  108. data/rbi/dodopayments/models/product_list_response.rbi +3 -430
  109. data/rbi/dodopayments/models/product_update_params.rbi +35 -9
  110. data/rbi/dodopayments/models/scheduled_plan_change.rbi +141 -0
  111. data/rbi/dodopayments/models/subscription.rbi +24 -149
  112. data/rbi/dodopayments/models/subscription_create_params.rbi +36 -68
  113. data/rbi/dodopayments/models/subscription_create_response.rbi +47 -3
  114. data/rbi/dodopayments/models/subscription_list_response.rbi +4 -167
  115. data/rbi/dodopayments/models/subscription_update_params.rbi +27 -0
  116. data/rbi/dodopayments/models/unsafe_unwrap_webhook_event.rbi +5 -0
  117. data/rbi/dodopayments/models/unwrap_webhook_event.rbi +5 -0
  118. data/rbi/dodopayments/models/update_subscription_plan_req.rbi +10 -0
  119. data/rbi/dodopayments/models/webhook_event_type.rbi +5 -0
  120. data/rbi/dodopayments/models/webhook_payload.rbi +6 -197
  121. data/rbi/dodopayments/models.rbi +46 -0
  122. data/rbi/dodopayments/resources/checkout_sessions.rbi +16 -0
  123. data/rbi/dodopayments/resources/customers.rbi +14 -0
  124. data/rbi/dodopayments/resources/entitlements/files.rbi +45 -0
  125. data/rbi/dodopayments/resources/entitlements/grants.rbi +63 -0
  126. data/rbi/dodopayments/resources/entitlements.rbi +143 -0
  127. data/rbi/dodopayments/resources/license_key_instances.rbi +3 -0
  128. data/rbi/dodopayments/resources/payments.rbi +10 -2
  129. data/rbi/dodopayments/resources/products.rbi +34 -7
  130. data/rbi/dodopayments/resources/subscriptions.rbi +31 -5
  131. data/rbi/dodopayments/resources/webhooks.rbi +10 -0
  132. data/sig/dodopayments/client.rbs +2 -0
  133. data/sig/dodopayments/models/attach_product_entitlement.rbs +13 -0
  134. data/sig/dodopayments/models/cancellation_feedback.rbs +28 -0
  135. data/sig/dodopayments/models/checkout_session_flags.rbs +10 -3
  136. data/sig/dodopayments/models/checkout_session_request.rbs +5 -0
  137. data/sig/dodopayments/models/credit_entitlements/credit_ledger_entry.rbs +2 -0
  138. data/sig/dodopayments/models/credit_overage_reset_webhook_event.rbs +45 -0
  139. data/sig/dodopayments/models/customer_list_entitlements_params.rbs +23 -0
  140. data/sig/dodopayments/models/customer_list_entitlements_response.rbs +95 -0
  141. data/sig/dodopayments/models/digital_product_delivery.rbs +5 -5
  142. data/sig/dodopayments/models/digital_product_delivery_file.rbs +32 -5
  143. data/sig/dodopayments/models/entitlement.rbs +65 -0
  144. data/sig/dodopayments/models/entitlement_create_params.rbs +48 -0
  145. data/sig/dodopayments/models/entitlement_delete_params.rbs +23 -0
  146. data/sig/dodopayments/models/entitlement_grant_created_webhook_event.rbs +45 -0
  147. data/sig/dodopayments/models/entitlement_grant_delivered_webhook_event.rbs +45 -0
  148. data/sig/dodopayments/models/entitlement_grant_failed_webhook_event.rbs +45 -0
  149. data/sig/dodopayments/models/entitlement_grant_revoked_webhook_event.rbs +45 -0
  150. data/sig/dodopayments/models/entitlement_integration_type.rbs +28 -0
  151. data/sig/dodopayments/models/entitlement_list_params.rbs +69 -0
  152. data/sig/dodopayments/models/entitlement_retrieve_params.rbs +23 -0
  153. data/sig/dodopayments/models/entitlement_update_params.rbs +46 -0
  154. data/sig/dodopayments/models/entitlements/entitlement_grant.rbs +127 -0
  155. data/sig/dodopayments/models/entitlements/file_delete_params.rbs +30 -0
  156. data/sig/dodopayments/models/entitlements/file_upload_params.rbs +25 -0
  157. data/sig/dodopayments/models/entitlements/file_upload_response.rbs +15 -0
  158. data/sig/dodopayments/models/entitlements/grant_list_params.rbs +71 -0
  159. data/sig/dodopayments/models/entitlements/grant_revoke_params.rbs +30 -0
  160. data/sig/dodopayments/models/entitlements/license_key_grant.rbs +37 -0
  161. data/sig/dodopayments/models/integration_config.rbs +171 -0
  162. data/sig/dodopayments/models/integration_config_response.rbs +225 -0
  163. data/sig/dodopayments/models/license_key_instance_list_params.rbs +10 -1
  164. data/sig/dodopayments/models/one_time_product_cart_item.rbs +14 -3
  165. data/sig/dodopayments/models/payment.rbs +16 -4
  166. data/sig/dodopayments/models/payment_create_params.rbs +16 -27
  167. data/sig/dodopayments/models/payment_create_response.rbs +4 -27
  168. data/sig/dodopayments/models/product.rbs +4 -205
  169. data/sig/dodopayments/models/product_create_params.rbs +4 -4
  170. data/sig/dodopayments/models/product_entitlement_summary.rbs +40 -0
  171. data/sig/dodopayments/models/product_list_response.rbs +4 -205
  172. data/sig/dodopayments/models/product_update_params.rbs +4 -4
  173. data/sig/dodopayments/models/scheduled_plan_change.rbs +73 -0
  174. data/sig/dodopayments/models/subscription.rbs +14 -74
  175. data/sig/dodopayments/models/subscription_create_params.rbs +16 -27
  176. data/sig/dodopayments/models/subscription_create_response.rbs +16 -4
  177. data/sig/dodopayments/models/subscription_list_response.rbs +4 -74
  178. data/sig/dodopayments/models/subscription_update_params.rbs +12 -0
  179. data/sig/dodopayments/models/unsafe_unwrap_webhook_event.rbs +5 -0
  180. data/sig/dodopayments/models/unwrap_webhook_event.rbs +5 -0
  181. data/sig/dodopayments/models/update_subscription_plan_req.rbs +5 -0
  182. data/sig/dodopayments/models/webhook_event_type.rbs +2 -0
  183. data/sig/dodopayments/models/webhook_payload.rbs +8 -134
  184. data/sig/dodopayments/models.rbs +40 -0
  185. data/sig/dodopayments/resources/checkout_sessions.rbs +2 -0
  186. data/sig/dodopayments/resources/customers.rbs +5 -0
  187. data/sig/dodopayments/resources/entitlements/files.rbs +20 -0
  188. data/sig/dodopayments/resources/entitlements/grants.rbs +24 -0
  189. data/sig/dodopayments/resources/entitlements.rbs +46 -0
  190. data/sig/dodopayments/resources/license_key_instances.rbs +1 -0
  191. data/sig/dodopayments/resources/payments.rbs +3 -1
  192. data/sig/dodopayments/resources/products.rbs +2 -2
  193. data/sig/dodopayments/resources/subscriptions.rbs +7 -1
  194. data/sig/dodopayments/resources/webhooks.rbs +10 -0
  195. metadata +92 -2
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dodopayments
4
+ module Models
5
+ module Entitlements
6
+ # @see Dodopayments::Resources::Entitlements::Grants#list
7
+ class GrantListParams < Dodopayments::Internal::Type::BaseModel
8
+ extend Dodopayments::Internal::Type::RequestParameters::Converter
9
+ include Dodopayments::Internal::Type::RequestParameters
10
+
11
+ # @!attribute id
12
+ #
13
+ # @return [String]
14
+ required :id, String
15
+
16
+ # @!attribute customer_id
17
+ # Filter by customer ID
18
+ #
19
+ # @return [String, nil]
20
+ optional :customer_id, String
21
+
22
+ # @!attribute page_number
23
+ # Page number (default 0)
24
+ #
25
+ # @return [Integer, nil]
26
+ optional :page_number, Integer
27
+
28
+ # @!attribute page_size
29
+ # Page size (default 10, max 100)
30
+ #
31
+ # @return [Integer, nil]
32
+ optional :page_size, Integer
33
+
34
+ # @!attribute status
35
+ # Filter by grant status
36
+ #
37
+ # @return [Symbol, Dodopayments::Models::Entitlements::GrantListParams::Status, nil]
38
+ optional :status, enum: -> { Dodopayments::Entitlements::GrantListParams::Status }
39
+
40
+ # @!method initialize(id:, customer_id: nil, page_number: nil, page_size: nil, status: nil, request_options: {})
41
+ # @param id [String]
42
+ #
43
+ # @param customer_id [String] Filter by customer ID
44
+ #
45
+ # @param page_number [Integer] Page number (default 0)
46
+ #
47
+ # @param page_size [Integer] Page size (default 10, max 100)
48
+ #
49
+ # @param status [Symbol, Dodopayments::Models::Entitlements::GrantListParams::Status] Filter by grant status
50
+ #
51
+ # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}]
52
+
53
+ # Filter by grant status
54
+ module Status
55
+ extend Dodopayments::Internal::Type::Enum
56
+
57
+ PENDING = :Pending
58
+ DELIVERED = :Delivered
59
+ FAILED = :Failed
60
+ REVOKED = :Revoked
61
+
62
+ # @!method self.values
63
+ # @return [Array<Symbol>]
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dodopayments
4
+ module Models
5
+ module Entitlements
6
+ # @see Dodopayments::Resources::Entitlements::Grants#revoke
7
+ class GrantRevokeParams < Dodopayments::Internal::Type::BaseModel
8
+ extend Dodopayments::Internal::Type::RequestParameters::Converter
9
+ include Dodopayments::Internal::Type::RequestParameters
10
+
11
+ # @!attribute id
12
+ #
13
+ # @return [String]
14
+ required :id, String
15
+
16
+ # @!attribute grant_id
17
+ #
18
+ # @return [String]
19
+ required :grant_id, String
20
+
21
+ # @!method initialize(id:, grant_id:, request_options: {})
22
+ # @param id [String]
23
+ # @param grant_id [String]
24
+ # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}]
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dodopayments
4
+ module Models
5
+ module Entitlements
6
+ class LicenseKeyGrant < Dodopayments::Internal::Type::BaseModel
7
+ # @!attribute activations_used
8
+ # Number of activations consumed so far.
9
+ #
10
+ # @return [Integer]
11
+ required :activations_used, Integer
12
+
13
+ # @!attribute key
14
+ # Issued license key.
15
+ #
16
+ # @return [String]
17
+ required :key, String
18
+
19
+ # @!attribute activations_limit
20
+ # Maximum activations allowed by the entitlement, when set.
21
+ #
22
+ # @return [Integer, nil]
23
+ optional :activations_limit, Integer, nil?: true
24
+
25
+ # @!attribute expires_at
26
+ # When the license key expires, when applicable.
27
+ #
28
+ # @return [Time, nil]
29
+ optional :expires_at, Time, nil?: true
30
+
31
+ # @!method initialize(activations_used:, key:, activations_limit: nil, expires_at: 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.
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,217 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dodopayments
4
+ module Models
5
+ # Integration-specific configuration supplied when creating or updating an
6
+ # entitlement. The shape required matches the entitlement's `integration_type`.
7
+ module IntegrationConfig
8
+ extend Dodopayments::Internal::Type::Union
9
+
10
+ variant -> { Dodopayments::IntegrationConfig::GitHubConfig }
11
+
12
+ variant -> { Dodopayments::IntegrationConfig::DiscordConfig }
13
+
14
+ variant -> { Dodopayments::IntegrationConfig::TelegramConfig }
15
+
16
+ variant -> { Dodopayments::IntegrationConfig::FigmaConfig }
17
+
18
+ variant -> { Dodopayments::IntegrationConfig::FramerConfig }
19
+
20
+ variant -> { Dodopayments::IntegrationConfig::NotionConfig }
21
+
22
+ variant -> { Dodopayments::IntegrationConfig::DigitalFilesConfig }
23
+
24
+ variant -> { Dodopayments::IntegrationConfig::LicenseKeyConfig }
25
+
26
+ class GitHubConfig < Dodopayments::Internal::Type::BaseModel
27
+ # @!attribute permission
28
+ # Permission to grant on the repository.
29
+ #
30
+ # @return [Symbol, Dodopayments::Models::IntegrationConfig::GitHubConfig::Permission]
31
+ required :permission, enum: -> { Dodopayments::IntegrationConfig::GitHubConfig::Permission }
32
+
33
+ # @!attribute target_id
34
+ # Repository or organisation slug to grant access to.
35
+ #
36
+ # @return [String]
37
+ required :target_id, String
38
+
39
+ # @!method initialize(permission:, target_id:)
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.
45
+ #
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
59
+ end
60
+
61
+ class DiscordConfig < Dodopayments::Internal::Type::BaseModel
62
+ # @!attribute guild_id
63
+ # Discord guild (server) ID.
64
+ #
65
+ # @return [String]
66
+ required :guild_id, String
67
+
68
+ # @!attribute role_id
69
+ # Optional Discord role to assign within the guild.
70
+ #
71
+ # @return [String, nil]
72
+ optional :role_id, String, nil?: true
73
+
74
+ # @!method initialize(guild_id:, role_id: 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.
78
+ end
79
+
80
+ class TelegramConfig < Dodopayments::Internal::Type::BaseModel
81
+ # @!attribute chat_id
82
+ # Telegram chat ID. For groups this is typically a negative integer.
83
+ #
84
+ # @return [String]
85
+ required :chat_id, String
86
+
87
+ # @!method initialize(chat_id:)
88
+ # @param chat_id [String] Telegram chat ID. For groups this is typically a negative integer.
89
+ end
90
+
91
+ class FigmaConfig < Dodopayments::Internal::Type::BaseModel
92
+ # @!attribute figma_file_id
93
+ # Figma file identifier to grant access to.
94
+ #
95
+ # @return [String]
96
+ required :figma_file_id, String
97
+
98
+ # @!method initialize(figma_file_id:)
99
+ # @param figma_file_id [String] Figma file identifier to grant access to.
100
+ end
101
+
102
+ class FramerConfig < Dodopayments::Internal::Type::BaseModel
103
+ # @!attribute framer_template_id
104
+ # Framer template identifier to grant access to.
105
+ #
106
+ # @return [String]
107
+ required :framer_template_id, String
108
+
109
+ # @!method initialize(framer_template_id:)
110
+ # @param framer_template_id [String] Framer template identifier to grant access to.
111
+ end
112
+
113
+ class NotionConfig < Dodopayments::Internal::Type::BaseModel
114
+ # @!attribute notion_template_id
115
+ # Notion template identifier to grant access to.
116
+ #
117
+ # @return [String]
118
+ required :notion_template_id, String
119
+
120
+ # @!method initialize(notion_template_id:)
121
+ # @param notion_template_id [String] Notion template identifier to grant access to.
122
+ end
123
+
124
+ class DigitalFilesConfig < Dodopayments::Internal::Type::BaseModel
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}`.
129
+ #
130
+ # @return [Array<String>]
131
+ required :digital_file_ids, Dodopayments::Internal::Type::ArrayOf[String]
132
+
133
+ # @!attribute external_url
134
+ # Optional external URL shown to the customer alongside the files.
135
+ #
136
+ # @return [String, nil]
137
+ optional :external_url, String, nil?: true
138
+
139
+ # @!attribute instructions
140
+ # Optional human-readable delivery instructions shown to the customer alongside
141
+ # the files.
142
+ #
143
+ # @return [String, nil]
144
+ optional :instructions, String, nil?: true
145
+
146
+ # @!attribute legacy_file_ids
147
+ # Three-way patchable list of legacy file identifiers:
148
+ #
149
+ # - omitted → preserve the current value
150
+ # - `null` → clear
151
+ # - `[...]` → replace
152
+ #
153
+ # On create, an omitted field, an explicit `null`, or an empty array all result in
154
+ # no legacy files attached.
155
+ #
156
+ # @return [Array<String>, nil]
157
+ optional :legacy_file_ids, Dodopayments::Internal::Type::ArrayOf[String], nil?: true
158
+
159
+ # @!method initialize(digital_file_ids:, external_url: nil, instructions: nil, legacy_file_ids: nil)
160
+ # Some parameter documentations has been truncated, see
161
+ # {Dodopayments::Models::IntegrationConfig::DigitalFilesConfig} for more details.
162
+ #
163
+ # @param digital_file_ids [Array<String>] Files attached to this entitlement. Add files via
164
+ #
165
+ # @param external_url [String, nil] Optional external URL shown to the customer alongside the files.
166
+ #
167
+ # @param instructions [String, nil] Optional human-readable delivery instructions shown to the customer
168
+ #
169
+ # @param legacy_file_ids [Array<String>, nil] Three-way patchable list of legacy file identifiers:
170
+ end
171
+
172
+ class LicenseKeyConfig < Dodopayments::Internal::Type::BaseModel
173
+ # @!attribute activation_message
174
+ # Optional message displayed when a customer activates the license key (≤ 2500
175
+ # characters).
176
+ #
177
+ # @return [String, nil]
178
+ optional :activation_message, String, nil?: true
179
+
180
+ # @!attribute activations_limit
181
+ # Maximum activations allowed per issued license key. Omit for unlimited.
182
+ #
183
+ # @return [Integer, nil]
184
+ optional :activations_limit, Integer, nil?: true
185
+
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.
190
+ #
191
+ # @return [Integer, nil]
192
+ optional :duration_count, Integer, nil?: true
193
+
194
+ # @!attribute duration_interval
195
+ # Unit of `duration_count`.
196
+ #
197
+ # @return [Symbol, Dodopayments::Models::TimeInterval, nil]
198
+ optional :duration_interval, enum: -> { Dodopayments::TimeInterval }, nil?: true
199
+
200
+ # @!method initialize(activation_message: nil, activations_limit: nil, duration_count: nil, duration_interval: 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`.
211
+ end
212
+
213
+ # @!method self.variants
214
+ # @return [Array(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)]
215
+ end
216
+ end
217
+ end
@@ -0,0 +1,278 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dodopayments
4
+ module Models
5
+ # Integration-specific configuration on an entitlement read response.
6
+ #
7
+ # For `digital_files` entitlements the response includes presigned download URLs
8
+ # for each attached file; other integrations match the shape supplied at creation.
9
+ module IntegrationConfigResponse
10
+ extend Dodopayments::Internal::Type::Union
11
+
12
+ variant -> { Dodopayments::IntegrationConfigResponse::GitHubConfig }
13
+
14
+ variant -> { Dodopayments::IntegrationConfigResponse::DiscordConfig }
15
+
16
+ variant -> { Dodopayments::IntegrationConfigResponse::TelegramConfig }
17
+
18
+ variant -> { Dodopayments::IntegrationConfigResponse::FigmaConfig }
19
+
20
+ variant -> { Dodopayments::IntegrationConfigResponse::FramerConfig }
21
+
22
+ variant -> { Dodopayments::IntegrationConfigResponse::NotionConfig }
23
+
24
+ variant -> { Dodopayments::IntegrationConfigResponse::DigitalFilesConfig }
25
+
26
+ variant -> { Dodopayments::IntegrationConfigResponse::LicenseKeyConfig }
27
+
28
+ class GitHubConfig < Dodopayments::Internal::Type::BaseModel
29
+ # @!attribute permission
30
+ # Permission to grant on the repository.
31
+ #
32
+ # @return [Symbol, Dodopayments::Models::IntegrationConfigResponse::GitHubConfig::Permission]
33
+ required :permission, enum: -> { Dodopayments::IntegrationConfigResponse::GitHubConfig::Permission }
34
+
35
+ # @!attribute target_id
36
+ # Repository or organisation slug to grant access to.
37
+ #
38
+ # @return [String]
39
+ required :target_id, String
40
+
41
+ # @!method initialize(permission:, target_id:)
42
+ # @param permission [Symbol, Dodopayments::Models::IntegrationConfigResponse::GitHubConfig::Permission] Permission to grant on the repository.
43
+ #
44
+ # @param target_id [String] Repository or organisation slug to grant access to.
45
+
46
+ # Permission to grant on the repository.
47
+ #
48
+ # @see Dodopayments::Models::IntegrationConfigResponse::GitHubConfig#permission
49
+ module Permission
50
+ extend Dodopayments::Internal::Type::Enum
51
+
52
+ PULL = :pull
53
+ PUSH = :push
54
+ ADMIN = :admin
55
+ MAINTAIN = :maintain
56
+ TRIAGE = :triage
57
+
58
+ # @!method self.values
59
+ # @return [Array<Symbol>]
60
+ end
61
+ end
62
+
63
+ class DiscordConfig < Dodopayments::Internal::Type::BaseModel
64
+ # @!attribute guild_id
65
+ # Discord guild (server) ID.
66
+ #
67
+ # @return [String]
68
+ required :guild_id, String
69
+
70
+ # @!attribute role_id
71
+ # Optional Discord role to assign within the guild.
72
+ #
73
+ # @return [String, nil]
74
+ optional :role_id, String, nil?: true
75
+
76
+ # @!method initialize(guild_id:, role_id: nil)
77
+ # @param guild_id [String] Discord guild (server) ID.
78
+ #
79
+ # @param role_id [String, nil] Optional Discord role to assign within the guild.
80
+ end
81
+
82
+ class TelegramConfig < Dodopayments::Internal::Type::BaseModel
83
+ # @!attribute chat_id
84
+ # Telegram chat ID. For groups this is typically a negative integer.
85
+ #
86
+ # @return [String]
87
+ required :chat_id, String
88
+
89
+ # @!method initialize(chat_id:)
90
+ # @param chat_id [String] Telegram chat ID. For groups this is typically a negative integer.
91
+ end
92
+
93
+ class FigmaConfig < Dodopayments::Internal::Type::BaseModel
94
+ # @!attribute figma_file_id
95
+ # Figma file identifier to grant access to.
96
+ #
97
+ # @return [String]
98
+ required :figma_file_id, String
99
+
100
+ # @!method initialize(figma_file_id:)
101
+ # @param figma_file_id [String] Figma file identifier to grant access to.
102
+ end
103
+
104
+ class FramerConfig < Dodopayments::Internal::Type::BaseModel
105
+ # @!attribute framer_template_id
106
+ # Framer template identifier to grant access to.
107
+ #
108
+ # @return [String]
109
+ required :framer_template_id, String
110
+
111
+ # @!method initialize(framer_template_id:)
112
+ # @param framer_template_id [String] Framer template identifier to grant access to.
113
+ end
114
+
115
+ class NotionConfig < Dodopayments::Internal::Type::BaseModel
116
+ # @!attribute notion_template_id
117
+ # Notion template identifier to grant access to.
118
+ #
119
+ # @return [String]
120
+ required :notion_template_id, String
121
+
122
+ # @!method initialize(notion_template_id:)
123
+ # @param notion_template_id [String] Notion template identifier to grant access to.
124
+ end
125
+
126
+ class DigitalFilesConfig < Dodopayments::Internal::Type::BaseModel
127
+ # @!attribute digital_files
128
+ # Populated digital-files payload with each file's metadata and a short-lived
129
+ # presigned download URL.
130
+ #
131
+ # @return [Dodopayments::Models::IntegrationConfigResponse::DigitalFilesConfig::DigitalFiles]
132
+ required :digital_files, -> { Dodopayments::IntegrationConfigResponse::DigitalFilesConfig::DigitalFiles }
133
+
134
+ # @!method initialize(digital_files:)
135
+ # Some parameter documentations has been truncated, see
136
+ # {Dodopayments::Models::IntegrationConfigResponse::DigitalFilesConfig} for more
137
+ # details.
138
+ #
139
+ # @param digital_files [Dodopayments::Models::IntegrationConfigResponse::DigitalFilesConfig::DigitalFiles] Populated digital-files payload with each file's metadata and a
140
+
141
+ # @see Dodopayments::Models::IntegrationConfigResponse::DigitalFilesConfig#digital_files
142
+ class DigitalFiles < Dodopayments::Internal::Type::BaseModel
143
+ # @!attribute files
144
+ # One entry per attached file.
145
+ #
146
+ # @return [Array<Dodopayments::Models::IntegrationConfigResponse::DigitalFilesConfig::DigitalFiles::File>]
147
+ required :files,
148
+ -> { Dodopayments::Internal::Type::ArrayOf[Dodopayments::IntegrationConfigResponse::DigitalFilesConfig::DigitalFiles::File] }
149
+
150
+ # @!attribute external_url
151
+ # Optional external URL, passed through from the entitlement configuration.
152
+ #
153
+ # @return [String, nil]
154
+ optional :external_url, String, nil?: true
155
+
156
+ # @!attribute instructions
157
+ # Optional human-readable delivery instructions, passed through from the
158
+ # entitlement configuration.
159
+ #
160
+ # @return [String, nil]
161
+ optional :instructions, String, nil?: true
162
+
163
+ # @!method initialize(files:, external_url: nil, instructions: nil)
164
+ # Some parameter documentations has been truncated, see
165
+ # {Dodopayments::Models::IntegrationConfigResponse::DigitalFilesConfig::DigitalFiles}
166
+ # for more details.
167
+ #
168
+ # Populated digital-files payload with each file's metadata and a short-lived
169
+ # presigned download URL.
170
+ #
171
+ # @param files [Array<Dodopayments::Models::IntegrationConfigResponse::DigitalFilesConfig::DigitalFiles::File>] One entry per attached file.
172
+ #
173
+ # @param external_url [String, nil] Optional external URL, passed through from the entitlement
174
+ #
175
+ # @param instructions [String, nil] Optional human-readable delivery instructions, passed through from
176
+
177
+ class File < Dodopayments::Internal::Type::BaseModel
178
+ # @!attribute download_url
179
+ # Short-lived presigned URL for downloading the file.
180
+ #
181
+ # @return [String]
182
+ required :download_url, String
183
+
184
+ # @!attribute expires_in
185
+ # Seconds until `download_url` expires.
186
+ #
187
+ # @return [Integer]
188
+ required :expires_in, Integer
189
+
190
+ # @!attribute file_id
191
+ # Identifier of the attached file.
192
+ #
193
+ # @return [String]
194
+ required :file_id, String
195
+
196
+ # @!attribute filename
197
+ # Original filename of the attached file.
198
+ #
199
+ # @return [String]
200
+ required :filename, String
201
+
202
+ # @!attribute content_type
203
+ # Optional content-type declared at upload.
204
+ #
205
+ # @return [String, nil]
206
+ optional :content_type, String, nil?: true
207
+
208
+ # @!attribute file_size
209
+ # Optional size of the file in bytes.
210
+ #
211
+ # @return [Integer, nil]
212
+ optional :file_size, Integer, nil?: true
213
+
214
+ # @!method initialize(download_url:, expires_in:, file_id:, filename:, content_type: nil, file_size: nil)
215
+ # One file in a resolved digital-files payload.
216
+ #
217
+ # @param download_url [String] Short-lived presigned URL for downloading the file.
218
+ #
219
+ # @param expires_in [Integer] Seconds until `download_url` expires.
220
+ #
221
+ # @param file_id [String] Identifier of the attached file.
222
+ #
223
+ # @param filename [String] Original filename of the attached file.
224
+ #
225
+ # @param content_type [String, nil] Optional content-type declared at upload.
226
+ #
227
+ # @param file_size [Integer, nil] Optional size of the file in bytes.
228
+ end
229
+ end
230
+ end
231
+
232
+ class LicenseKeyConfig < Dodopayments::Internal::Type::BaseModel
233
+ # @!attribute activation_message
234
+ # Optional message displayed when a customer activates the license key (≤ 2500
235
+ # characters).
236
+ #
237
+ # @return [String, nil]
238
+ optional :activation_message, String, nil?: true
239
+
240
+ # @!attribute activations_limit
241
+ # Maximum activations allowed per issued license key. Omit for unlimited.
242
+ #
243
+ # @return [Integer, nil]
244
+ optional :activations_limit, Integer, nil?: true
245
+
246
+ # @!attribute duration_count
247
+ # Validity duration of issued license keys. Provide both `duration_count` and
248
+ # `duration_interval` together for a fixed duration; omit both for non-expiring
249
+ # keys.
250
+ #
251
+ # @return [Integer, nil]
252
+ optional :duration_count, Integer, nil?: true
253
+
254
+ # @!attribute duration_interval
255
+ # Unit of `duration_count`.
256
+ #
257
+ # @return [Symbol, Dodopayments::Models::TimeInterval, nil]
258
+ optional :duration_interval, enum: -> { Dodopayments::TimeInterval }, nil?: true
259
+
260
+ # @!method initialize(activation_message: nil, activations_limit: nil, duration_count: nil, duration_interval: nil)
261
+ # Some parameter documentations has been truncated, see
262
+ # {Dodopayments::Models::IntegrationConfigResponse::LicenseKeyConfig} for more
263
+ # details.
264
+ #
265
+ # @param activation_message [String, nil] Optional message displayed when a customer activates the license
266
+ #
267
+ # @param activations_limit [Integer, nil] Maximum activations allowed per issued license key. Omit for unlimited.
268
+ #
269
+ # @param duration_count [Integer, nil] Validity duration of issued license keys. Provide both
270
+ #
271
+ # @param duration_interval [Symbol, Dodopayments::Models::TimeInterval, nil] Unit of `duration_count`.
272
+ end
273
+
274
+ # @!method self.variants
275
+ # @return [Array(Dodopayments::Models::IntegrationConfigResponse::GitHubConfig, Dodopayments::Models::IntegrationConfigResponse::DiscordConfig, Dodopayments::Models::IntegrationConfigResponse::TelegramConfig, Dodopayments::Models::IntegrationConfigResponse::FigmaConfig, Dodopayments::Models::IntegrationConfigResponse::FramerConfig, Dodopayments::Models::IntegrationConfigResponse::NotionConfig, Dodopayments::Models::IntegrationConfigResponse::DigitalFilesConfig, Dodopayments::Models::IntegrationConfigResponse::LicenseKeyConfig)]
276
+ end
277
+ end
278
+ end
@@ -7,6 +7,12 @@ module Dodopayments
7
7
  extend Dodopayments::Internal::Type::RequestParameters::Converter
8
8
  include Dodopayments::Internal::Type::RequestParameters
9
9
 
10
+ # @!attribute grant_id
11
+ # Filter instances by entitlement grant ID
12
+ #
13
+ # @return [String, nil]
14
+ optional :grant_id, String, nil?: true
15
+
10
16
  # @!attribute license_key_id
11
17
  # Filter by license key ID
12
18
  #
@@ -25,7 +31,9 @@ module Dodopayments
25
31
  # @return [Integer, nil]
26
32
  optional :page_size, Integer, nil?: true
27
33
 
28
- # @!method initialize(license_key_id: nil, page_number: nil, page_size: nil, request_options: {})
34
+ # @!method initialize(grant_id: nil, license_key_id: nil, page_number: nil, page_size: nil, request_options: {})
35
+ # @param grant_id [String, nil] Filter instances by entitlement grant ID
36
+ #
29
37
  # @param license_key_id [String, nil] Filter by license key ID
30
38
  #
31
39
  # @param page_number [Integer, nil] Page number default is 0
@@ -13,9 +13,23 @@ module Dodopayments
13
13
  # @return [Integer]
14
14
  required :quantity, Integer
15
15
 
16
- # @!method initialize(product_id:, quantity:)
16
+ # @!attribute amount
17
+ # Amount the customer pays if pay_what_you_want is enabled. If disabled then
18
+ # amount will be ignored Represented in the lowest denomination of the currency
19
+ # (e.g., cents for USD). For example, to charge $1.00, pass `100`.
20
+ #
21
+ # @return [Integer, nil]
22
+ optional :amount, Integer, nil?: true
23
+
24
+ # @!method initialize(product_id:, quantity:, amount: nil)
25
+ # Some parameter documentations has been truncated, see
26
+ # {Dodopayments::Models::OneTimeProductCartItem} for more details.
27
+ #
17
28
  # @param product_id [String]
29
+ #
18
30
  # @param quantity [Integer]
31
+ #
32
+ # @param amount [Integer, nil] Amount the customer pays if pay_what_you_want is enabled. If disabled then amoun
19
33
  end
20
34
  end
21
35
  end