dodopayments 2.6.0 → 2.7.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 (43) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -0
  3. data/README.md +1 -1
  4. data/lib/dodopayments/internal/util.rb +3 -1
  5. data/lib/dodopayments/models/license_key.rb +33 -10
  6. data/lib/dodopayments/models/license_key_create_params.rb +54 -0
  7. data/lib/dodopayments/models/license_key_list_params.rb +20 -1
  8. data/lib/dodopayments/models/product.rb +228 -1
  9. data/lib/dodopayments/models/product_create_params.rb +15 -1
  10. data/lib/dodopayments/models/product_list_response.rb +225 -1
  11. data/lib/dodopayments/models/product_update_params.rb +16 -1
  12. data/lib/dodopayments/models/webhook_event_type.rb +4 -0
  13. data/lib/dodopayments/models/webhook_payload.rb +176 -3
  14. data/lib/dodopayments/models.rb +2 -0
  15. data/lib/dodopayments/resources/license_keys.rb +37 -1
  16. data/lib/dodopayments/resources/products.rb +6 -2
  17. data/lib/dodopayments/version.rb +1 -1
  18. data/lib/dodopayments.rb +1 -0
  19. data/rbi/dodopayments/models/license_key.rbi +39 -8
  20. data/rbi/dodopayments/models/license_key_create_params.rbi +78 -0
  21. data/rbi/dodopayments/models/license_key_list_params.rbi +44 -0
  22. data/rbi/dodopayments/models/product.rbi +425 -0
  23. data/rbi/dodopayments/models/product_create_params.rbi +8 -0
  24. data/rbi/dodopayments/models/product_list_response.rbi +436 -0
  25. data/rbi/dodopayments/models/product_update_params.rbi +10 -0
  26. data/rbi/dodopayments/models/webhook_event_type.rbi +20 -0
  27. data/rbi/dodopayments/models/webhook_payload.rbi +267 -4
  28. data/rbi/dodopayments/models.rbi +2 -0
  29. data/rbi/dodopayments/resources/license_keys.rbi +28 -0
  30. data/rbi/dodopayments/resources/products.rbi +7 -0
  31. data/sig/dodopayments/models/license_key.rbs +21 -5
  32. data/sig/dodopayments/models/license_key_create_params.rbs +46 -0
  33. data/sig/dodopayments/models/license_key_list_params.rbs +20 -0
  34. data/sig/dodopayments/models/product.rbs +206 -0
  35. data/sig/dodopayments/models/product_create_params.rbs +5 -0
  36. data/sig/dodopayments/models/product_list_response.rbs +206 -0
  37. data/sig/dodopayments/models/product_update_params.rbs +5 -0
  38. data/sig/dodopayments/models/webhook_event_type.rbs +8 -0
  39. data/sig/dodopayments/models/webhook_payload.rbs +158 -0
  40. data/sig/dodopayments/models.rbs +2 -0
  41. data/sig/dodopayments/resources/license_keys.rbs +10 -0
  42. data/sig/dodopayments/resources/products.rbs +2 -0
  43. metadata +5 -2
@@ -16,6 +16,13 @@ module Dodopayments
16
16
  # @return [Time]
17
17
  required :created_at, Time
18
18
 
19
+ # @!attribute entitlements
20
+ # Entitlements linked to this product
21
+ #
22
+ # @return [Array<Dodopayments::Models::ProductListResponse::Entitlement>]
23
+ required :entitlements,
24
+ -> { Dodopayments::Internal::Type::ArrayOf[Dodopayments::Models::ProductListResponse::Entitlement] }
25
+
19
26
  # @!attribute is_recurring
20
27
  # Indicates if the product is recurring (e.g., subscriptions).
21
28
  #
@@ -97,7 +104,7 @@ module Dodopayments
97
104
  # @return [Boolean, nil]
98
105
  optional :tax_inclusive, Dodopayments::Internal::Type::Boolean, nil?: true
99
106
 
100
- # @!method initialize(business_id:, created_at:, is_recurring:, metadata:, product_id:, tax_category:, updated_at:, currency: nil, description: nil, image: nil, name: nil, price: nil, price_detail: nil, tax_inclusive: nil)
107
+ # @!method initialize(business_id:, created_at:, entitlements:, is_recurring:, metadata:, product_id:, tax_category:, updated_at:, currency: nil, description: nil, image: nil, name: nil, price: nil, price_detail: nil, tax_inclusive: nil)
101
108
  # Some parameter documentations has been truncated, see
102
109
  # {Dodopayments::Models::ProductListResponse} for more details.
103
110
  #
@@ -105,6 +112,8 @@ module Dodopayments
105
112
  #
106
113
  # @param created_at [Time] Timestamp when the product was created.
107
114
  #
115
+ # @param entitlements [Array<Dodopayments::Models::ProductListResponse::Entitlement>] Entitlements linked to this product
116
+ #
108
117
  # @param is_recurring [Boolean] Indicates if the product is recurring (e.g., subscriptions).
109
118
  #
110
119
  # @param metadata [Hash{Symbol=>String}] Additional custom data associated with the product
@@ -128,6 +137,221 @@ module Dodopayments
128
137
  # @param price_detail [Dodopayments::Models::Price::OneTimePrice, Dodopayments::Models::Price::RecurringPrice, Dodopayments::Models::Price::UsageBasedPrice, nil] Details of the price
129
138
  #
130
139
  # @param tax_inclusive [Boolean, nil] Indicates if the price is tax inclusive
140
+
141
+ class Entitlement < Dodopayments::Internal::Type::BaseModel
142
+ # @!attribute id
143
+ #
144
+ # @return [String]
145
+ required :id, String
146
+
147
+ # @!attribute integration_config
148
+ # Platform-specific configuration for an entitlement. Each variant uses unique
149
+ # field names so `#[serde(untagged)]` can disambiguate correctly.
150
+ #
151
+ # @return [Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::GitHubConfig, Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::DiscordConfig, Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::TelegramConfig, Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::FigmaConfig, Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::FramerConfig, Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::NotionConfig, Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::DigitalFilesConfig, Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::LicenseKeyConfig]
152
+ required :integration_config,
153
+ union: -> { Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig }
154
+
155
+ # @!attribute integration_type
156
+ #
157
+ # @return [Symbol, Dodopayments::Models::ProductListResponse::Entitlement::IntegrationType]
158
+ required :integration_type,
159
+ enum: -> { Dodopayments::Models::ProductListResponse::Entitlement::IntegrationType }
160
+
161
+ # @!attribute name
162
+ #
163
+ # @return [String]
164
+ required :name, String
165
+
166
+ # @!attribute description
167
+ #
168
+ # @return [String, nil]
169
+ optional :description, String, nil?: true
170
+
171
+ # @!method initialize(id:, integration_config:, integration_type:, name:, description: nil)
172
+ # Some parameter documentations has been truncated, see
173
+ # {Dodopayments::Models::ProductListResponse::Entitlement} for more details.
174
+ #
175
+ # Summary of an entitlement attached to a product
176
+ #
177
+ # @param id [String]
178
+ #
179
+ # @param integration_config [Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::GitHubConfig, Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::DiscordConfig, Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::TelegramConfig, Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::FigmaConfig, Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::FramerConfig, Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::NotionConfig, Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::DigitalFilesConfig, Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::LicenseKeyConfig] Platform-specific configuration for an entitlement.
180
+ #
181
+ # @param integration_type [Symbol, Dodopayments::Models::ProductListResponse::Entitlement::IntegrationType]
182
+ #
183
+ # @param name [String]
184
+ #
185
+ # @param description [String, nil]
186
+
187
+ # Platform-specific configuration for an entitlement. Each variant uses unique
188
+ # field names so `#[serde(untagged)]` can disambiguate correctly.
189
+ #
190
+ # @see Dodopayments::Models::ProductListResponse::Entitlement#integration_config
191
+ module IntegrationConfig
192
+ extend Dodopayments::Internal::Type::Union
193
+
194
+ variant -> { Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::GitHubConfig }
195
+
196
+ variant -> { Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::DiscordConfig }
197
+
198
+ variant -> { Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::TelegramConfig }
199
+
200
+ variant -> { Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::FigmaConfig }
201
+
202
+ variant -> { Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::FramerConfig }
203
+
204
+ variant -> { Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::NotionConfig }
205
+
206
+ variant -> { Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::DigitalFilesConfig }
207
+
208
+ variant -> { Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::LicenseKeyConfig }
209
+
210
+ class GitHubConfig < Dodopayments::Internal::Type::BaseModel
211
+ # @!attribute permission
212
+ # One of: pull, push, admin, maintain, triage
213
+ #
214
+ # @return [String]
215
+ required :permission, String
216
+
217
+ # @!attribute target_id
218
+ #
219
+ # @return [String]
220
+ required :target_id, String
221
+
222
+ # @!method initialize(permission:, target_id:)
223
+ # @param permission [String] One of: pull, push, admin, maintain, triage
224
+ #
225
+ # @param target_id [String]
226
+ end
227
+
228
+ class DiscordConfig < Dodopayments::Internal::Type::BaseModel
229
+ # @!attribute guild_id
230
+ #
231
+ # @return [String]
232
+ required :guild_id, String
233
+
234
+ # @!attribute role_id
235
+ #
236
+ # @return [String, nil]
237
+ optional :role_id, String, nil?: true
238
+
239
+ # @!method initialize(guild_id:, role_id: nil)
240
+ # @param guild_id [String]
241
+ # @param role_id [String, nil]
242
+ end
243
+
244
+ class TelegramConfig < Dodopayments::Internal::Type::BaseModel
245
+ # @!attribute chat_id
246
+ #
247
+ # @return [String]
248
+ required :chat_id, String
249
+
250
+ # @!method initialize(chat_id:)
251
+ # @param chat_id [String]
252
+ end
253
+
254
+ class FigmaConfig < Dodopayments::Internal::Type::BaseModel
255
+ # @!attribute figma_file_id
256
+ #
257
+ # @return [String]
258
+ required :figma_file_id, String
259
+
260
+ # @!method initialize(figma_file_id:)
261
+ # @param figma_file_id [String]
262
+ end
263
+
264
+ class FramerConfig < Dodopayments::Internal::Type::BaseModel
265
+ # @!attribute framer_template_id
266
+ #
267
+ # @return [String]
268
+ required :framer_template_id, String
269
+
270
+ # @!method initialize(framer_template_id:)
271
+ # @param framer_template_id [String]
272
+ end
273
+
274
+ class NotionConfig < Dodopayments::Internal::Type::BaseModel
275
+ # @!attribute notion_template_id
276
+ #
277
+ # @return [String]
278
+ required :notion_template_id, String
279
+
280
+ # @!method initialize(notion_template_id:)
281
+ # @param notion_template_id [String]
282
+ end
283
+
284
+ class DigitalFilesConfig < Dodopayments::Internal::Type::BaseModel
285
+ # @!attribute digital_file_ids
286
+ #
287
+ # @return [Array<String>]
288
+ required :digital_file_ids, Dodopayments::Internal::Type::ArrayOf[String]
289
+
290
+ # @!attribute external_url
291
+ #
292
+ # @return [String, nil]
293
+ optional :external_url, String, nil?: true
294
+
295
+ # @!attribute instructions
296
+ #
297
+ # @return [String, nil]
298
+ optional :instructions, String, nil?: true
299
+
300
+ # @!method initialize(digital_file_ids:, external_url: nil, instructions: nil)
301
+ # @param digital_file_ids [Array<String>]
302
+ # @param external_url [String, nil]
303
+ # @param instructions [String, nil]
304
+ end
305
+
306
+ class LicenseKeyConfig < Dodopayments::Internal::Type::BaseModel
307
+ # @!attribute activation_message
308
+ #
309
+ # @return [String, nil]
310
+ optional :activation_message, String, nil?: true
311
+
312
+ # @!attribute activations_limit
313
+ #
314
+ # @return [Integer, nil]
315
+ optional :activations_limit, Integer, nil?: true
316
+
317
+ # @!attribute duration_count
318
+ #
319
+ # @return [Integer, nil]
320
+ optional :duration_count, Integer, nil?: true
321
+
322
+ # @!attribute duration_interval
323
+ #
324
+ # @return [String, nil]
325
+ optional :duration_interval, String, nil?: true
326
+
327
+ # @!method initialize(activation_message: nil, activations_limit: nil, duration_count: nil, duration_interval: nil)
328
+ # @param activation_message [String, nil]
329
+ # @param activations_limit [Integer, nil]
330
+ # @param duration_count [Integer, nil]
331
+ # @param duration_interval [String, nil]
332
+ end
333
+
334
+ # @!method self.variants
335
+ # @return [Array(Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::GitHubConfig, Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::DiscordConfig, Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::TelegramConfig, Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::FigmaConfig, Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::FramerConfig, Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::NotionConfig, Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::DigitalFilesConfig, Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::LicenseKeyConfig)]
336
+ end
337
+
338
+ # @see Dodopayments::Models::ProductListResponse::Entitlement#integration_type
339
+ module IntegrationType
340
+ extend Dodopayments::Internal::Type::Enum
341
+
342
+ DISCORD = :discord
343
+ TELEGRAM = :telegram
344
+ GITHUB = :github
345
+ FIGMA = :figma
346
+ FRAMER = :framer
347
+ NOTION = :notion
348
+ DIGITAL_FILES = :digital_files
349
+ LICENSE_KEY = :license_key
350
+
351
+ # @!method self.values
352
+ # @return [Array<Symbol>]
353
+ end
354
+ end
131
355
  end
132
356
  end
133
357
  end
@@ -46,6 +46,13 @@ module Dodopayments
46
46
  -> { Dodopayments::ProductUpdateParams::DigitalProductDelivery },
47
47
  nil?: true
48
48
 
49
+ # @!attribute entitlement_ids
50
+ # Entitlement IDs to attach (replaces all existing when present) Send empty array
51
+ # to remove all, omit field to leave unchanged
52
+ #
53
+ # @return [Array<String>, nil]
54
+ optional :entitlement_ids, Dodopayments::Internal::Type::ArrayOf[String], nil?: true
55
+
49
56
  # @!attribute image_id
50
57
  # Product image id after its uploaded to S3
51
58
  #
@@ -53,6 +60,8 @@ module Dodopayments
53
60
  optional :image_id, String, nil?: true
54
61
 
55
62
  # @!attribute license_key_activation_message
63
+ # @deprecated
64
+ #
56
65
  # Message sent to the customer upon license key activation.
57
66
  #
58
67
  # Only applicable if `license_key_enabled` is `true`. This message contains
@@ -62,6 +71,8 @@ module Dodopayments
62
71
  optional :license_key_activation_message, String, nil?: true
63
72
 
64
73
  # @!attribute license_key_activations_limit
74
+ # @deprecated
75
+ #
65
76
  # Limit for the number of activations for the license key.
66
77
  #
67
78
  # Only applicable if `license_key_enabled` is `true`. Represents the maximum
@@ -80,6 +91,8 @@ module Dodopayments
80
91
  optional :license_key_duration, -> { Dodopayments::LicenseKeyDuration }, nil?: true
81
92
 
82
93
  # @!attribute license_key_enabled
94
+ # @deprecated
95
+ #
83
96
  # Whether the product requires a license key.
84
97
  #
85
98
  # If `true`, additional fields related to license key (duration, activations
@@ -112,7 +125,7 @@ module Dodopayments
112
125
  # @return [Symbol, Dodopayments::Models::TaxCategory, nil]
113
126
  optional :tax_category, enum: -> { Dodopayments::TaxCategory }, nil?: true
114
127
 
115
- # @!method initialize(id:, addons: nil, brand_id: nil, credit_entitlements: nil, description: nil, digital_product_delivery: nil, image_id: nil, license_key_activation_message: nil, license_key_activations_limit: nil, license_key_duration: nil, license_key_enabled: nil, metadata: nil, name: nil, price: nil, tax_category: nil, request_options: {})
128
+ # @!method initialize(id:, addons: nil, brand_id: nil, credit_entitlements: nil, description: nil, digital_product_delivery: nil, entitlement_ids: nil, image_id: nil, license_key_activation_message: nil, license_key_activations_limit: nil, license_key_duration: nil, license_key_enabled: nil, metadata: nil, name: nil, price: nil, tax_category: nil, request_options: {})
116
129
  # Some parameter documentations has been truncated, see
117
130
  # {Dodopayments::Models::ProductUpdateParams} for more details.
118
131
  #
@@ -128,6 +141,8 @@ module Dodopayments
128
141
  #
129
142
  # @param digital_product_delivery [Dodopayments::Models::ProductUpdateParams::DigitalProductDelivery, nil] Choose how you would like you digital product delivered
130
143
  #
144
+ # @param entitlement_ids [Array<String>, nil] Entitlement IDs to attach (replaces all existing when present)
145
+ #
131
146
  # @param image_id [String, nil] Product image id after its uploaded to S3
132
147
  #
133
148
  # @param license_key_activation_message [String, nil] Message sent to the customer upon license key activation.
@@ -47,6 +47,10 @@ module Dodopayments
47
47
  DUNNING_RECOVERED = :"dunning.recovered"
48
48
  ACR_EMAIL = :"acr.email"
49
49
  DUNNING_EMAIL = :"dunning.email"
50
+ ENTITLEMENT_GRANT_CREATED = :"entitlement_grant.created"
51
+ ENTITLEMENT_GRANT_DELIVERED = :"entitlement_grant.delivered"
52
+ ENTITLEMENT_GRANT_FAILED = :"entitlement_grant.failed"
53
+ ENTITLEMENT_GRANT_REVOKED = :"entitlement_grant.revoked"
50
54
 
51
55
  # @!method self.values
52
56
  # @return [Array<Symbol>]
@@ -11,7 +11,7 @@ module Dodopayments
11
11
  # @!attribute data
12
12
  # The latest data at the time of delivery attempt
13
13
  #
14
- # @return [Dodopayments::Models::WebhookPayload::Data::Payment, Dodopayments::Models::WebhookPayload::Data::Subscription, Dodopayments::Models::WebhookPayload::Data::Refund, Dodopayments::Models::WebhookPayload::Data::Dispute, Dodopayments::Models::WebhookPayload::Data::LicenseKey, Dodopayments::Models::WebhookPayload::Data::CreditLedgerEntry, Dodopayments::Models::WebhookPayload::Data::CreditBalanceLow, Dodopayments::Models::WebhookPayload::Data::AbandonedCheckout, Dodopayments::Models::WebhookPayload::Data::DunningAttempt]
14
+ # @return [Dodopayments::Models::WebhookPayload::Data::Payment, Dodopayments::Models::WebhookPayload::Data::Subscription, Dodopayments::Models::WebhookPayload::Data::Refund, Dodopayments::Models::WebhookPayload::Data::Dispute, Dodopayments::Models::WebhookPayload::Data::LicenseKey, Dodopayments::Models::WebhookPayload::Data::CreditLedgerEntry, Dodopayments::Models::WebhookPayload::Data::CreditBalanceLow, Dodopayments::Models::WebhookPayload::Data::AbandonedCheckout, Dodopayments::Models::WebhookPayload::Data::DunningAttempt, Dodopayments::Models::WebhookPayload::Data::EntitlementGrant]
15
15
  required :data, union: -> { Dodopayments::WebhookPayload::Data }
16
16
 
17
17
  # @!attribute timestamp
@@ -33,7 +33,7 @@ module Dodopayments
33
33
  #
34
34
  # @param business_id [String]
35
35
  #
36
- # @param data [Dodopayments::Models::WebhookPayload::Data::Payment, Dodopayments::Models::WebhookPayload::Data::Subscription, Dodopayments::Models::WebhookPayload::Data::Refund, Dodopayments::Models::WebhookPayload::Data::Dispute, Dodopayments::Models::WebhookPayload::Data::LicenseKey, Dodopayments::Models::WebhookPayload::Data::CreditLedgerEntry, Dodopayments::Models::WebhookPayload::Data::CreditBalanceLow, Dodopayments::Models::WebhookPayload::Data::AbandonedCheckout, Dodopayments::Models::WebhookPayload::Data::DunningAttempt] The latest data at the time of delivery attempt
36
+ # @param data [Dodopayments::Models::WebhookPayload::Data::Payment, Dodopayments::Models::WebhookPayload::Data::Subscription, Dodopayments::Models::WebhookPayload::Data::Refund, Dodopayments::Models::WebhookPayload::Data::Dispute, Dodopayments::Models::WebhookPayload::Data::LicenseKey, Dodopayments::Models::WebhookPayload::Data::CreditLedgerEntry, Dodopayments::Models::WebhookPayload::Data::CreditBalanceLow, Dodopayments::Models::WebhookPayload::Data::AbandonedCheckout, Dodopayments::Models::WebhookPayload::Data::DunningAttempt, Dodopayments::Models::WebhookPayload::Data::EntitlementGrant] The latest data at the time of delivery attempt
37
37
  #
38
38
  # @param timestamp [Time] The timestamp of when the event occurred (not necessarily the same of when it wa
39
39
  #
@@ -65,6 +65,8 @@ module Dodopayments
65
65
 
66
66
  variant -> { Dodopayments::WebhookPayload::Data::DunningAttempt }
67
67
 
68
+ variant -> { Dodopayments::WebhookPayload::Data::EntitlementGrant }
69
+
68
70
  class Payment < Dodopayments::Models::Payment
69
71
  # @!attribute payload_type
70
72
  #
@@ -412,8 +414,179 @@ module Dodopayments
412
414
  end
413
415
  end
414
416
 
417
+ class EntitlementGrant < Dodopayments::Internal::Type::BaseModel
418
+ # @!attribute id
419
+ #
420
+ # @return [String]
421
+ required :id, String
422
+
423
+ # @!attribute business_id
424
+ #
425
+ # @return [String]
426
+ required :business_id, String
427
+
428
+ # @!attribute created_at
429
+ #
430
+ # @return [Time]
431
+ required :created_at, Time
432
+
433
+ # @!attribute customer_id
434
+ #
435
+ # @return [String]
436
+ required :customer_id, String
437
+
438
+ # @!attribute entitlement_id
439
+ #
440
+ # @return [String]
441
+ required :entitlement_id, String
442
+
443
+ # @!attribute external_id
444
+ #
445
+ # @return [String]
446
+ required :external_id, String
447
+
448
+ # @!attribute payload_type
449
+ #
450
+ # @return [Symbol, Dodopayments::Models::WebhookPayload::Data::EntitlementGrant::PayloadType]
451
+ required :payload_type, enum: -> { Dodopayments::WebhookPayload::Data::EntitlementGrant::PayloadType }
452
+
453
+ # @!attribute status
454
+ #
455
+ # @return [Symbol, Dodopayments::Models::WebhookPayload::Data::EntitlementGrant::Status]
456
+ required :status, enum: -> { Dodopayments::WebhookPayload::Data::EntitlementGrant::Status }
457
+
458
+ # @!attribute updated_at
459
+ #
460
+ # @return [Time]
461
+ required :updated_at, Time
462
+
463
+ # @!attribute delivered_at
464
+ #
465
+ # @return [Time, nil]
466
+ optional :delivered_at, Time, nil?: true
467
+
468
+ # @!attribute error_code
469
+ #
470
+ # @return [String, nil]
471
+ optional :error_code, String, nil?: true
472
+
473
+ # @!attribute error_message
474
+ #
475
+ # @return [String, nil]
476
+ optional :error_message, String, nil?: true
477
+
478
+ # @!attribute license_key
479
+ #
480
+ # @return [String, nil]
481
+ optional :license_key, String, nil?: true
482
+
483
+ # @!attribute license_key_activations_limit
484
+ #
485
+ # @return [Integer, nil]
486
+ optional :license_key_activations_limit, Integer, nil?: true
487
+
488
+ # @!attribute license_key_activations_used
489
+ #
490
+ # @return [Integer, nil]
491
+ optional :license_key_activations_used, Integer, nil?: true
492
+
493
+ # @!attribute license_key_expires_at
494
+ #
495
+ # @return [Time, nil]
496
+ optional :license_key_expires_at, Time, nil?: true
497
+
498
+ # @!attribute license_key_status
499
+ #
500
+ # @return [String, nil]
501
+ optional :license_key_status, String, nil?: true
502
+
503
+ # @!attribute metadata
504
+ #
505
+ # @return [Object, nil]
506
+ optional :metadata, Dodopayments::Internal::Type::Unknown
507
+
508
+ # @!attribute oauth_expires_at
509
+ #
510
+ # @return [Time, nil]
511
+ optional :oauth_expires_at, Time, nil?: true
512
+
513
+ # @!attribute oauth_url
514
+ #
515
+ # @return [String, nil]
516
+ optional :oauth_url, String, nil?: true
517
+
518
+ # @!attribute payment_id
519
+ #
520
+ # @return [String, nil]
521
+ optional :payment_id, String, nil?: true
522
+
523
+ # @!attribute revocation_reason
524
+ #
525
+ # @return [String, nil]
526
+ optional :revocation_reason, String, nil?: true
527
+
528
+ # @!attribute revoked_at
529
+ #
530
+ # @return [Time, nil]
531
+ optional :revoked_at, Time, nil?: true
532
+
533
+ # @!attribute subscription_id
534
+ #
535
+ # @return [String, nil]
536
+ optional :subscription_id, String, nil?: true
537
+
538
+ # @!method initialize(id:, business_id:, created_at:, customer_id:, entitlement_id:, external_id:, payload_type:, status:, updated_at:, delivered_at: nil, error_code: nil, error_message: nil, license_key: nil, license_key_activations_limit: nil, license_key_activations_used: nil, license_key_expires_at: nil, license_key_status: nil, metadata: nil, oauth_expires_at: nil, oauth_url: nil, payment_id: nil, revocation_reason: nil, revoked_at: nil, subscription_id: nil)
539
+ # @param id [String]
540
+ # @param business_id [String]
541
+ # @param created_at [Time]
542
+ # @param customer_id [String]
543
+ # @param entitlement_id [String]
544
+ # @param external_id [String]
545
+ # @param payload_type [Symbol, Dodopayments::Models::WebhookPayload::Data::EntitlementGrant::PayloadType]
546
+ # @param status [Symbol, Dodopayments::Models::WebhookPayload::Data::EntitlementGrant::Status]
547
+ # @param updated_at [Time]
548
+ # @param delivered_at [Time, nil]
549
+ # @param error_code [String, nil]
550
+ # @param error_message [String, nil]
551
+ # @param license_key [String, nil]
552
+ # @param license_key_activations_limit [Integer, nil]
553
+ # @param license_key_activations_used [Integer, nil]
554
+ # @param license_key_expires_at [Time, nil]
555
+ # @param license_key_status [String, nil]
556
+ # @param metadata [Object]
557
+ # @param oauth_expires_at [Time, nil]
558
+ # @param oauth_url [String, nil]
559
+ # @param payment_id [String, nil]
560
+ # @param revocation_reason [String, nil]
561
+ # @param revoked_at [Time, nil]
562
+ # @param subscription_id [String, nil]
563
+
564
+ # @see Dodopayments::Models::WebhookPayload::Data::EntitlementGrant#payload_type
565
+ module PayloadType
566
+ extend Dodopayments::Internal::Type::Enum
567
+
568
+ ENTITLEMENT_GRANT = :EntitlementGrant
569
+
570
+ # @!method self.values
571
+ # @return [Array<Symbol>]
572
+ end
573
+
574
+ # @see Dodopayments::Models::WebhookPayload::Data::EntitlementGrant#status
575
+ module Status
576
+ extend Dodopayments::Internal::Type::Enum
577
+
578
+ PENDING = :Pending
579
+ DELIVERED = :Delivered
580
+ FAILED = :Failed
581
+ REVOKED = :Revoked
582
+
583
+ # @!method self.values
584
+ # @return [Array<Symbol>]
585
+ end
586
+ end
587
+
415
588
  # @!method self.variants
416
- # @return [Array(Dodopayments::Models::WebhookPayload::Data::Payment, Dodopayments::Models::WebhookPayload::Data::Subscription, Dodopayments::Models::WebhookPayload::Data::Refund, Dodopayments::Models::WebhookPayload::Data::Dispute, Dodopayments::Models::WebhookPayload::Data::LicenseKey, Dodopayments::Models::WebhookPayload::Data::CreditLedgerEntry, Dodopayments::Models::WebhookPayload::Data::CreditBalanceLow, Dodopayments::Models::WebhookPayload::Data::AbandonedCheckout, Dodopayments::Models::WebhookPayload::Data::DunningAttempt)]
589
+ # @return [Array(Dodopayments::Models::WebhookPayload::Data::Payment, Dodopayments::Models::WebhookPayload::Data::Subscription, Dodopayments::Models::WebhookPayload::Data::Refund, Dodopayments::Models::WebhookPayload::Data::Dispute, Dodopayments::Models::WebhookPayload::Data::LicenseKey, Dodopayments::Models::WebhookPayload::Data::CreditLedgerEntry, Dodopayments::Models::WebhookPayload::Data::CreditBalanceLow, Dodopayments::Models::WebhookPayload::Data::AbandonedCheckout, Dodopayments::Models::WebhookPayload::Data::DunningAttempt, Dodopayments::Models::WebhookPayload::Data::EntitlementGrant)]
417
590
  end
418
591
  end
419
592
  end
@@ -245,6 +245,8 @@ module Dodopayments
245
245
 
246
246
  LicenseKeyCreatedWebhookEvent = Dodopayments::Models::LicenseKeyCreatedWebhookEvent
247
247
 
248
+ LicenseKeyCreateParams = Dodopayments::Models::LicenseKeyCreateParams
249
+
248
250
  LicenseKeyDuration = Dodopayments::Models::LicenseKeyDuration
249
251
 
250
252
  LicenseKeyInstance = Dodopayments::Models::LicenseKeyInstance
@@ -3,6 +3,36 @@
3
3
  module Dodopayments
4
4
  module Resources
5
5
  class LicenseKeys
6
+ # @overload create(customer_id:, key:, product_id:, activations_limit: nil, expires_at: nil, request_options: {})
7
+ #
8
+ # @param customer_id [String] The customer this license key belongs to.
9
+ #
10
+ # @param key [String] The license key string to import.
11
+ #
12
+ # @param product_id [String] The product this license key is for.
13
+ #
14
+ # @param activations_limit [Integer, nil] Maximum number of activations allowed. Null means unlimited.
15
+ #
16
+ # @param expires_at [Time, nil] Expiration timestamp. Null means the key never expires.
17
+ #
18
+ # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
19
+ #
20
+ # @return [Dodopayments::Models::LicenseKey]
21
+ #
22
+ # @see Dodopayments::Models::LicenseKeyCreateParams
23
+ def create(params)
24
+ parsed, options = Dodopayments::LicenseKeyCreateParams.dump_request(params)
25
+ @client.request(
26
+ method: :post,
27
+ path: "license_keys",
28
+ body: parsed,
29
+ model: Dodopayments::LicenseKey,
30
+ options: options
31
+ )
32
+ end
33
+
34
+ # @deprecated
35
+ #
6
36
  # @overload retrieve(id, request_options: {})
7
37
  #
8
38
  # @param id [String] License key ID
@@ -21,6 +51,8 @@ module Dodopayments
21
51
  )
22
52
  end
23
53
 
54
+ # @deprecated
55
+ #
24
56
  # Some parameter documentations has been truncated, see
25
57
  # {Dodopayments::Models::LicenseKeyUpdateParams} for more details.
26
58
  #
@@ -50,7 +82,9 @@ module Dodopayments
50
82
  )
51
83
  end
52
84
 
53
- # @overload list(created_at_gte: nil, created_at_lte: nil, customer_id: nil, page_number: nil, page_size: nil, product_id: nil, status: nil, request_options: {})
85
+ # @deprecated
86
+ #
87
+ # @overload list(created_at_gte: nil, created_at_lte: nil, customer_id: nil, page_number: nil, page_size: nil, product_id: nil, source: nil, status: nil, request_options: {})
54
88
  #
55
89
  # @param created_at_gte [Time] Filter license keys created on or after this timestamp
56
90
  #
@@ -64,6 +98,8 @@ module Dodopayments
64
98
  #
65
99
  # @param product_id [String] Filter by product ID
66
100
  #
101
+ # @param source [Symbol, Dodopayments::Models::LicenseKeyListParams::Source] Filter by license key source
102
+ #
67
103
  # @param status [Symbol, Dodopayments::Models::LicenseKeyListParams::Status] Filter by license key status
68
104
  #
69
105
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
@@ -12,7 +12,7 @@ module Dodopayments
12
12
  # Some parameter documentations has been truncated, see
13
13
  # {Dodopayments::Models::ProductCreateParams} for more details.
14
14
  #
15
- # @overload create(name:, price:, tax_category:, addons: nil, brand_id: nil, credit_entitlements: nil, description: nil, digital_product_delivery: nil, license_key_activation_message: nil, license_key_activations_limit: nil, license_key_duration: nil, license_key_enabled: nil, metadata: nil, request_options: {})
15
+ # @overload create(name:, price:, tax_category:, addons: nil, brand_id: nil, credit_entitlements: nil, description: nil, digital_product_delivery: nil, entitlement_ids: nil, license_key_activation_message: nil, license_key_activations_limit: nil, license_key_duration: nil, license_key_enabled: nil, metadata: nil, request_options: {})
16
16
  #
17
17
  # @param name [String] Name of the product
18
18
  #
@@ -30,6 +30,8 @@ module Dodopayments
30
30
  #
31
31
  # @param digital_product_delivery [Dodopayments::Models::ProductCreateParams::DigitalProductDelivery, nil] Choose how you would like you digital product delivered
32
32
  #
33
+ # @param entitlement_ids [Array<String>, nil] Optional entitlement IDs to attach to this product (max 20)
34
+ #
33
35
  # @param license_key_activation_message [String, nil] Optional message displayed during license key activation
34
36
  #
35
37
  # @param license_key_activations_limit [Integer, nil] The number of times the license key can be activated.
@@ -77,7 +79,7 @@ module Dodopayments
77
79
  # Some parameter documentations has been truncated, see
78
80
  # {Dodopayments::Models::ProductUpdateParams} for more details.
79
81
  #
80
- # @overload update(id, addons: nil, brand_id: nil, credit_entitlements: nil, description: nil, digital_product_delivery: nil, image_id: nil, license_key_activation_message: nil, license_key_activations_limit: nil, license_key_duration: nil, license_key_enabled: nil, metadata: nil, name: nil, price: nil, tax_category: nil, request_options: {})
82
+ # @overload update(id, addons: nil, brand_id: nil, credit_entitlements: nil, description: nil, digital_product_delivery: nil, entitlement_ids: nil, image_id: nil, license_key_activation_message: nil, license_key_activations_limit: nil, license_key_duration: nil, license_key_enabled: nil, metadata: nil, name: nil, price: nil, tax_category: nil, request_options: {})
81
83
  #
82
84
  # @param id [String]
83
85
  #
@@ -91,6 +93,8 @@ module Dodopayments
91
93
  #
92
94
  # @param digital_product_delivery [Dodopayments::Models::ProductUpdateParams::DigitalProductDelivery, nil] Choose how you would like you digital product delivered
93
95
  #
96
+ # @param entitlement_ids [Array<String>, nil] Entitlement IDs to attach (replaces all existing when present)
97
+ #
94
98
  # @param image_id [String, nil] Product image id after its uploaded to S3
95
99
  #
96
100
  # @param license_key_activation_message [String, nil] Message sent to the customer upon license key activation.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dodopayments
4
- VERSION = "2.6.0"
4
+ VERSION = "2.7.0"
5
5
  end
data/lib/dodopayments.rb CHANGED
@@ -186,6 +186,7 @@ require_relative "dodopayments/models/license_activate_params"
186
186
  require_relative "dodopayments/models/license_activate_response"
187
187
  require_relative "dodopayments/models/license_deactivate_params"
188
188
  require_relative "dodopayments/models/license_key_created_webhook_event"
189
+ require_relative "dodopayments/models/license_key_create_params"
189
190
  require_relative "dodopayments/models/license_key_duration"
190
191
  require_relative "dodopayments/models/license_key_instance"
191
192
  require_relative "dodopayments/models/license_key_instance_list_params"