dodopayments 2.6.0 → 2.7.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 (43) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -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
@@ -23,6 +23,10 @@ module Dodopayments
23
23
  sig { returns(T::Array[Dodopayments::CreditEntitlementMappingResponse]) }
24
24
  attr_accessor :credit_entitlements
25
25
 
26
+ # Attached entitlements (integration-based access grants)
27
+ sig { returns(T::Array[Dodopayments::Product::Entitlement]) }
28
+ attr_accessor :entitlements
29
+
26
30
  # Indicates if the product is recurring (e.g., subscriptions).
27
31
  sig { returns(T::Boolean) }
28
32
  attr_accessor :is_recurring
@@ -109,6 +113,7 @@ module Dodopayments
109
113
  created_at: Time,
110
114
  credit_entitlements:
111
115
  T::Array[Dodopayments::CreditEntitlementMappingResponse::OrHash],
116
+ entitlements: T::Array[Dodopayments::Product::Entitlement::OrHash],
112
117
  is_recurring: T::Boolean,
113
118
  license_key_enabled: T::Boolean,
114
119
  metadata: T::Hash[Symbol, String],
@@ -142,6 +147,8 @@ module Dodopayments
142
147
  created_at:,
143
148
  # Attached credit entitlements with settings
144
149
  credit_entitlements:,
150
+ # Attached entitlements (integration-based access grants)
151
+ entitlements:,
145
152
  # Indicates if the product is recurring (e.g., subscriptions).
146
153
  is_recurring:,
147
154
  # Indicates whether the product requires a license key.
@@ -184,6 +191,7 @@ module Dodopayments
184
191
  created_at: Time,
185
192
  credit_entitlements:
186
193
  T::Array[Dodopayments::CreditEntitlementMappingResponse],
194
+ entitlements: T::Array[Dodopayments::Product::Entitlement],
187
195
  is_recurring: T::Boolean,
188
196
  license_key_enabled: T::Boolean,
189
197
  metadata: T::Hash[Symbol, String],
@@ -206,6 +214,423 @@ module Dodopayments
206
214
  end
207
215
  def to_hash
208
216
  end
217
+
218
+ class Entitlement < Dodopayments::Internal::Type::BaseModel
219
+ OrHash =
220
+ T.type_alias do
221
+ T.any(
222
+ Dodopayments::Product::Entitlement,
223
+ Dodopayments::Internal::AnyHash
224
+ )
225
+ end
226
+
227
+ sig { returns(String) }
228
+ attr_accessor :id
229
+
230
+ # Platform-specific configuration for an entitlement. Each variant uses unique
231
+ # field names so `#[serde(untagged)]` can disambiguate correctly.
232
+ sig do
233
+ returns(
234
+ Dodopayments::Product::Entitlement::IntegrationConfig::Variants
235
+ )
236
+ end
237
+ attr_accessor :integration_config
238
+
239
+ sig do
240
+ returns(
241
+ Dodopayments::Product::Entitlement::IntegrationType::TaggedSymbol
242
+ )
243
+ end
244
+ attr_accessor :integration_type
245
+
246
+ sig { returns(String) }
247
+ attr_accessor :name
248
+
249
+ sig { returns(T.nilable(String)) }
250
+ attr_accessor :description
251
+
252
+ # Summary of an entitlement attached to a product
253
+ sig do
254
+ params(
255
+ id: String,
256
+ integration_config:
257
+ T.any(
258
+ Dodopayments::Product::Entitlement::IntegrationConfig::GitHubConfig::OrHash,
259
+ Dodopayments::Product::Entitlement::IntegrationConfig::DiscordConfig::OrHash,
260
+ Dodopayments::Product::Entitlement::IntegrationConfig::TelegramConfig::OrHash,
261
+ Dodopayments::Product::Entitlement::IntegrationConfig::FigmaConfig::OrHash,
262
+ Dodopayments::Product::Entitlement::IntegrationConfig::FramerConfig::OrHash,
263
+ Dodopayments::Product::Entitlement::IntegrationConfig::NotionConfig::OrHash,
264
+ Dodopayments::Product::Entitlement::IntegrationConfig::DigitalFilesConfig::OrHash,
265
+ Dodopayments::Product::Entitlement::IntegrationConfig::LicenseKeyConfig::OrHash
266
+ ),
267
+ integration_type:
268
+ Dodopayments::Product::Entitlement::IntegrationType::OrSymbol,
269
+ name: String,
270
+ description: T.nilable(String)
271
+ ).returns(T.attached_class)
272
+ end
273
+ def self.new(
274
+ id:,
275
+ # Platform-specific configuration for an entitlement. Each variant uses unique
276
+ # field names so `#[serde(untagged)]` can disambiguate correctly.
277
+ integration_config:,
278
+ integration_type:,
279
+ name:,
280
+ description: nil
281
+ )
282
+ end
283
+
284
+ sig do
285
+ override.returns(
286
+ {
287
+ id: String,
288
+ integration_config:
289
+ Dodopayments::Product::Entitlement::IntegrationConfig::Variants,
290
+ integration_type:
291
+ Dodopayments::Product::Entitlement::IntegrationType::TaggedSymbol,
292
+ name: String,
293
+ description: T.nilable(String)
294
+ }
295
+ )
296
+ end
297
+ def to_hash
298
+ end
299
+
300
+ # Platform-specific configuration for an entitlement. Each variant uses unique
301
+ # field names so `#[serde(untagged)]` can disambiguate correctly.
302
+ module IntegrationConfig
303
+ extend Dodopayments::Internal::Type::Union
304
+
305
+ Variants =
306
+ T.type_alias do
307
+ T.any(
308
+ Dodopayments::Product::Entitlement::IntegrationConfig::GitHubConfig,
309
+ Dodopayments::Product::Entitlement::IntegrationConfig::DiscordConfig,
310
+ Dodopayments::Product::Entitlement::IntegrationConfig::TelegramConfig,
311
+ Dodopayments::Product::Entitlement::IntegrationConfig::FigmaConfig,
312
+ Dodopayments::Product::Entitlement::IntegrationConfig::FramerConfig,
313
+ Dodopayments::Product::Entitlement::IntegrationConfig::NotionConfig,
314
+ Dodopayments::Product::Entitlement::IntegrationConfig::DigitalFilesConfig,
315
+ Dodopayments::Product::Entitlement::IntegrationConfig::LicenseKeyConfig
316
+ )
317
+ end
318
+
319
+ class GitHubConfig < Dodopayments::Internal::Type::BaseModel
320
+ OrHash =
321
+ T.type_alias do
322
+ T.any(
323
+ Dodopayments::Product::Entitlement::IntegrationConfig::GitHubConfig,
324
+ Dodopayments::Internal::AnyHash
325
+ )
326
+ end
327
+
328
+ # One of: pull, push, admin, maintain, triage
329
+ sig { returns(String) }
330
+ attr_accessor :permission
331
+
332
+ sig { returns(String) }
333
+ attr_accessor :target_id
334
+
335
+ sig do
336
+ params(permission: String, target_id: String).returns(
337
+ T.attached_class
338
+ )
339
+ end
340
+ def self.new(
341
+ # One of: pull, push, admin, maintain, triage
342
+ permission:,
343
+ target_id:
344
+ )
345
+ end
346
+
347
+ sig { override.returns({ permission: String, target_id: String }) }
348
+ def to_hash
349
+ end
350
+ end
351
+
352
+ class DiscordConfig < Dodopayments::Internal::Type::BaseModel
353
+ OrHash =
354
+ T.type_alias do
355
+ T.any(
356
+ Dodopayments::Product::Entitlement::IntegrationConfig::DiscordConfig,
357
+ Dodopayments::Internal::AnyHash
358
+ )
359
+ end
360
+
361
+ sig { returns(String) }
362
+ attr_accessor :guild_id
363
+
364
+ sig { returns(T.nilable(String)) }
365
+ attr_accessor :role_id
366
+
367
+ sig do
368
+ params(guild_id: String, role_id: T.nilable(String)).returns(
369
+ T.attached_class
370
+ )
371
+ end
372
+ def self.new(guild_id:, role_id: nil)
373
+ end
374
+
375
+ sig do
376
+ override.returns({ guild_id: String, role_id: T.nilable(String) })
377
+ end
378
+ def to_hash
379
+ end
380
+ end
381
+
382
+ class TelegramConfig < Dodopayments::Internal::Type::BaseModel
383
+ OrHash =
384
+ T.type_alias do
385
+ T.any(
386
+ Dodopayments::Product::Entitlement::IntegrationConfig::TelegramConfig,
387
+ Dodopayments::Internal::AnyHash
388
+ )
389
+ end
390
+
391
+ sig { returns(String) }
392
+ attr_accessor :chat_id
393
+
394
+ sig { params(chat_id: String).returns(T.attached_class) }
395
+ def self.new(chat_id:)
396
+ end
397
+
398
+ sig { override.returns({ chat_id: String }) }
399
+ def to_hash
400
+ end
401
+ end
402
+
403
+ class FigmaConfig < Dodopayments::Internal::Type::BaseModel
404
+ OrHash =
405
+ T.type_alias do
406
+ T.any(
407
+ Dodopayments::Product::Entitlement::IntegrationConfig::FigmaConfig,
408
+ Dodopayments::Internal::AnyHash
409
+ )
410
+ end
411
+
412
+ sig { returns(String) }
413
+ attr_accessor :figma_file_id
414
+
415
+ sig { params(figma_file_id: String).returns(T.attached_class) }
416
+ def self.new(figma_file_id:)
417
+ end
418
+
419
+ sig { override.returns({ figma_file_id: String }) }
420
+ def to_hash
421
+ end
422
+ end
423
+
424
+ class FramerConfig < Dodopayments::Internal::Type::BaseModel
425
+ OrHash =
426
+ T.type_alias do
427
+ T.any(
428
+ Dodopayments::Product::Entitlement::IntegrationConfig::FramerConfig,
429
+ Dodopayments::Internal::AnyHash
430
+ )
431
+ end
432
+
433
+ sig { returns(String) }
434
+ attr_accessor :framer_template_id
435
+
436
+ sig { params(framer_template_id: String).returns(T.attached_class) }
437
+ def self.new(framer_template_id:)
438
+ end
439
+
440
+ sig { override.returns({ framer_template_id: String }) }
441
+ def to_hash
442
+ end
443
+ end
444
+
445
+ class NotionConfig < Dodopayments::Internal::Type::BaseModel
446
+ OrHash =
447
+ T.type_alias do
448
+ T.any(
449
+ Dodopayments::Product::Entitlement::IntegrationConfig::NotionConfig,
450
+ Dodopayments::Internal::AnyHash
451
+ )
452
+ end
453
+
454
+ sig { returns(String) }
455
+ attr_accessor :notion_template_id
456
+
457
+ sig { params(notion_template_id: String).returns(T.attached_class) }
458
+ def self.new(notion_template_id:)
459
+ end
460
+
461
+ sig { override.returns({ notion_template_id: String }) }
462
+ def to_hash
463
+ end
464
+ end
465
+
466
+ class DigitalFilesConfig < Dodopayments::Internal::Type::BaseModel
467
+ OrHash =
468
+ T.type_alias do
469
+ T.any(
470
+ Dodopayments::Product::Entitlement::IntegrationConfig::DigitalFilesConfig,
471
+ Dodopayments::Internal::AnyHash
472
+ )
473
+ end
474
+
475
+ sig { returns(T::Array[String]) }
476
+ attr_accessor :digital_file_ids
477
+
478
+ sig { returns(T.nilable(String)) }
479
+ attr_accessor :external_url
480
+
481
+ sig { returns(T.nilable(String)) }
482
+ attr_accessor :instructions
483
+
484
+ sig do
485
+ params(
486
+ digital_file_ids: T::Array[String],
487
+ external_url: T.nilable(String),
488
+ instructions: T.nilable(String)
489
+ ).returns(T.attached_class)
490
+ end
491
+ def self.new(
492
+ digital_file_ids:,
493
+ external_url: nil,
494
+ instructions: nil
495
+ )
496
+ end
497
+
498
+ sig do
499
+ override.returns(
500
+ {
501
+ digital_file_ids: T::Array[String],
502
+ external_url: T.nilable(String),
503
+ instructions: T.nilable(String)
504
+ }
505
+ )
506
+ end
507
+ def to_hash
508
+ end
509
+ end
510
+
511
+ class LicenseKeyConfig < Dodopayments::Internal::Type::BaseModel
512
+ OrHash =
513
+ T.type_alias do
514
+ T.any(
515
+ Dodopayments::Product::Entitlement::IntegrationConfig::LicenseKeyConfig,
516
+ Dodopayments::Internal::AnyHash
517
+ )
518
+ end
519
+
520
+ sig { returns(T.nilable(String)) }
521
+ attr_accessor :activation_message
522
+
523
+ sig { returns(T.nilable(Integer)) }
524
+ attr_accessor :activations_limit
525
+
526
+ sig { returns(T.nilable(Integer)) }
527
+ attr_accessor :duration_count
528
+
529
+ sig { returns(T.nilable(String)) }
530
+ attr_accessor :duration_interval
531
+
532
+ sig do
533
+ params(
534
+ activation_message: T.nilable(String),
535
+ activations_limit: T.nilable(Integer),
536
+ duration_count: T.nilable(Integer),
537
+ duration_interval: T.nilable(String)
538
+ ).returns(T.attached_class)
539
+ end
540
+ def self.new(
541
+ activation_message: nil,
542
+ activations_limit: nil,
543
+ duration_count: nil,
544
+ duration_interval: nil
545
+ )
546
+ end
547
+
548
+ sig do
549
+ override.returns(
550
+ {
551
+ activation_message: T.nilable(String),
552
+ activations_limit: T.nilable(Integer),
553
+ duration_count: T.nilable(Integer),
554
+ duration_interval: T.nilable(String)
555
+ }
556
+ )
557
+ end
558
+ def to_hash
559
+ end
560
+ end
561
+
562
+ sig do
563
+ override.returns(
564
+ T::Array[
565
+ Dodopayments::Product::Entitlement::IntegrationConfig::Variants
566
+ ]
567
+ )
568
+ end
569
+ def self.variants
570
+ end
571
+ end
572
+
573
+ module IntegrationType
574
+ extend Dodopayments::Internal::Type::Enum
575
+
576
+ TaggedSymbol =
577
+ T.type_alias do
578
+ T.all(Symbol, Dodopayments::Product::Entitlement::IntegrationType)
579
+ end
580
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
581
+
582
+ DISCORD =
583
+ T.let(
584
+ :discord,
585
+ Dodopayments::Product::Entitlement::IntegrationType::TaggedSymbol
586
+ )
587
+ TELEGRAM =
588
+ T.let(
589
+ :telegram,
590
+ Dodopayments::Product::Entitlement::IntegrationType::TaggedSymbol
591
+ )
592
+ GITHUB =
593
+ T.let(
594
+ :github,
595
+ Dodopayments::Product::Entitlement::IntegrationType::TaggedSymbol
596
+ )
597
+ FIGMA =
598
+ T.let(
599
+ :figma,
600
+ Dodopayments::Product::Entitlement::IntegrationType::TaggedSymbol
601
+ )
602
+ FRAMER =
603
+ T.let(
604
+ :framer,
605
+ Dodopayments::Product::Entitlement::IntegrationType::TaggedSymbol
606
+ )
607
+ NOTION =
608
+ T.let(
609
+ :notion,
610
+ Dodopayments::Product::Entitlement::IntegrationType::TaggedSymbol
611
+ )
612
+ DIGITAL_FILES =
613
+ T.let(
614
+ :digital_files,
615
+ Dodopayments::Product::Entitlement::IntegrationType::TaggedSymbol
616
+ )
617
+ LICENSE_KEY =
618
+ T.let(
619
+ :license_key,
620
+ Dodopayments::Product::Entitlement::IntegrationType::TaggedSymbol
621
+ )
622
+
623
+ sig do
624
+ override.returns(
625
+ T::Array[
626
+ Dodopayments::Product::Entitlement::IntegrationType::TaggedSymbol
627
+ ]
628
+ )
629
+ end
630
+ def self.values
631
+ end
632
+ end
633
+ end
209
634
  end
210
635
  end
211
636
  end
@@ -70,6 +70,10 @@ module Dodopayments
70
70
  end
71
71
  attr_writer :digital_product_delivery
72
72
 
73
+ # Optional entitlement IDs to attach to this product (max 20)
74
+ sig { returns(T.nilable(T::Array[String])) }
75
+ attr_accessor :entitlement_ids
76
+
73
77
  # Optional message displayed during license key activation
74
78
  sig { returns(T.nilable(String)) }
75
79
  attr_accessor :license_key_activation_message
@@ -122,6 +126,7 @@ module Dodopayments
122
126
  T.nilable(
123
127
  Dodopayments::ProductCreateParams::DigitalProductDelivery::OrHash
124
128
  ),
129
+ entitlement_ids: T.nilable(T::Array[String]),
125
130
  license_key_activation_message: T.nilable(String),
126
131
  license_key_activations_limit: T.nilable(Integer),
127
132
  license_key_duration:
@@ -148,6 +153,8 @@ module Dodopayments
148
153
  description: nil,
149
154
  # Choose how you would like you digital product delivered
150
155
  digital_product_delivery: nil,
156
+ # Optional entitlement IDs to attach to this product (max 20)
157
+ entitlement_ids: nil,
151
158
  # Optional message displayed during license key activation
152
159
  license_key_activation_message: nil,
153
160
  # The number of times the license key can be activated. Must be 0 or greater
@@ -184,6 +191,7 @@ module Dodopayments
184
191
  T.nilable(
185
192
  Dodopayments::ProductCreateParams::DigitalProductDelivery
186
193
  ),
194
+ entitlement_ids: T.nilable(T::Array[String]),
187
195
  license_key_activation_message: T.nilable(String),
188
196
  license_key_activations_limit: T.nilable(Integer),
189
197
  license_key_duration: T.nilable(Dodopayments::LicenseKeyDuration),