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
@@ -19,6 +19,14 @@ module Dodopayments
19
19
  sig { returns(Time) }
20
20
  attr_accessor :created_at
21
21
 
22
+ # Entitlements linked to this product
23
+ sig do
24
+ returns(
25
+ T::Array[Dodopayments::Models::ProductListResponse::Entitlement]
26
+ )
27
+ end
28
+ attr_accessor :entitlements
29
+
22
30
  # Indicates if the product is recurring (e.g., subscriptions).
23
31
  sig { returns(T::Boolean) }
24
32
  attr_accessor :is_recurring
@@ -80,6 +88,10 @@ module Dodopayments
80
88
  params(
81
89
  business_id: String,
82
90
  created_at: Time,
91
+ entitlements:
92
+ T::Array[
93
+ Dodopayments::Models::ProductListResponse::Entitlement::OrHash
94
+ ],
83
95
  is_recurring: T::Boolean,
84
96
  metadata: T::Hash[Symbol, String],
85
97
  product_id: String,
@@ -106,6 +118,8 @@ module Dodopayments
106
118
  business_id:,
107
119
  # Timestamp when the product was created.
108
120
  created_at:,
121
+ # Entitlements linked to this product
122
+ entitlements:,
109
123
  # Indicates if the product is recurring (e.g., subscriptions).
110
124
  is_recurring:,
111
125
  # Additional custom data associated with the product
@@ -147,6 +161,8 @@ module Dodopayments
147
161
  {
148
162
  business_id: String,
149
163
  created_at: Time,
164
+ entitlements:
165
+ T::Array[Dodopayments::Models::ProductListResponse::Entitlement],
150
166
  is_recurring: T::Boolean,
151
167
  metadata: T::Hash[Symbol, String],
152
168
  product_id: String,
@@ -164,6 +180,426 @@ module Dodopayments
164
180
  end
165
181
  def to_hash
166
182
  end
183
+
184
+ class Entitlement < Dodopayments::Internal::Type::BaseModel
185
+ OrHash =
186
+ T.type_alias do
187
+ T.any(
188
+ Dodopayments::Models::ProductListResponse::Entitlement,
189
+ Dodopayments::Internal::AnyHash
190
+ )
191
+ end
192
+
193
+ sig { returns(String) }
194
+ attr_accessor :id
195
+
196
+ # Platform-specific configuration for an entitlement. Each variant uses unique
197
+ # field names so `#[serde(untagged)]` can disambiguate correctly.
198
+ sig do
199
+ returns(
200
+ Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::Variants
201
+ )
202
+ end
203
+ attr_accessor :integration_config
204
+
205
+ sig do
206
+ returns(
207
+ Dodopayments::Models::ProductListResponse::Entitlement::IntegrationType::TaggedSymbol
208
+ )
209
+ end
210
+ attr_accessor :integration_type
211
+
212
+ sig { returns(String) }
213
+ attr_accessor :name
214
+
215
+ sig { returns(T.nilable(String)) }
216
+ attr_accessor :description
217
+
218
+ # Summary of an entitlement attached to a product
219
+ sig do
220
+ params(
221
+ id: String,
222
+ integration_config:
223
+ T.any(
224
+ Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::GitHubConfig::OrHash,
225
+ Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::DiscordConfig::OrHash,
226
+ Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::TelegramConfig::OrHash,
227
+ Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::FigmaConfig::OrHash,
228
+ Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::FramerConfig::OrHash,
229
+ Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::NotionConfig::OrHash,
230
+ Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::DigitalFilesConfig::OrHash,
231
+ Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::LicenseKeyConfig::OrHash
232
+ ),
233
+ integration_type:
234
+ Dodopayments::Models::ProductListResponse::Entitlement::IntegrationType::OrSymbol,
235
+ name: String,
236
+ description: T.nilable(String)
237
+ ).returns(T.attached_class)
238
+ end
239
+ def self.new(
240
+ id:,
241
+ # Platform-specific configuration for an entitlement. Each variant uses unique
242
+ # field names so `#[serde(untagged)]` can disambiguate correctly.
243
+ integration_config:,
244
+ integration_type:,
245
+ name:,
246
+ description: nil
247
+ )
248
+ end
249
+
250
+ sig do
251
+ override.returns(
252
+ {
253
+ id: String,
254
+ integration_config:
255
+ Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::Variants,
256
+ integration_type:
257
+ Dodopayments::Models::ProductListResponse::Entitlement::IntegrationType::TaggedSymbol,
258
+ name: String,
259
+ description: T.nilable(String)
260
+ }
261
+ )
262
+ end
263
+ def to_hash
264
+ end
265
+
266
+ # Platform-specific configuration for an entitlement. Each variant uses unique
267
+ # field names so `#[serde(untagged)]` can disambiguate correctly.
268
+ module IntegrationConfig
269
+ extend Dodopayments::Internal::Type::Union
270
+
271
+ Variants =
272
+ T.type_alias do
273
+ T.any(
274
+ Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::GitHubConfig,
275
+ Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::DiscordConfig,
276
+ Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::TelegramConfig,
277
+ Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::FigmaConfig,
278
+ Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::FramerConfig,
279
+ Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::NotionConfig,
280
+ Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::DigitalFilesConfig,
281
+ Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::LicenseKeyConfig
282
+ )
283
+ end
284
+
285
+ class GitHubConfig < Dodopayments::Internal::Type::BaseModel
286
+ OrHash =
287
+ T.type_alias do
288
+ T.any(
289
+ Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::GitHubConfig,
290
+ Dodopayments::Internal::AnyHash
291
+ )
292
+ end
293
+
294
+ # One of: pull, push, admin, maintain, triage
295
+ sig { returns(String) }
296
+ attr_accessor :permission
297
+
298
+ sig { returns(String) }
299
+ attr_accessor :target_id
300
+
301
+ sig do
302
+ params(permission: String, target_id: String).returns(
303
+ T.attached_class
304
+ )
305
+ end
306
+ def self.new(
307
+ # One of: pull, push, admin, maintain, triage
308
+ permission:,
309
+ target_id:
310
+ )
311
+ end
312
+
313
+ sig { override.returns({ permission: String, target_id: String }) }
314
+ def to_hash
315
+ end
316
+ end
317
+
318
+ class DiscordConfig < Dodopayments::Internal::Type::BaseModel
319
+ OrHash =
320
+ T.type_alias do
321
+ T.any(
322
+ Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::DiscordConfig,
323
+ Dodopayments::Internal::AnyHash
324
+ )
325
+ end
326
+
327
+ sig { returns(String) }
328
+ attr_accessor :guild_id
329
+
330
+ sig { returns(T.nilable(String)) }
331
+ attr_accessor :role_id
332
+
333
+ sig do
334
+ params(guild_id: String, role_id: T.nilable(String)).returns(
335
+ T.attached_class
336
+ )
337
+ end
338
+ def self.new(guild_id:, role_id: nil)
339
+ end
340
+
341
+ sig do
342
+ override.returns({ guild_id: String, role_id: T.nilable(String) })
343
+ end
344
+ def to_hash
345
+ end
346
+ end
347
+
348
+ class TelegramConfig < Dodopayments::Internal::Type::BaseModel
349
+ OrHash =
350
+ T.type_alias do
351
+ T.any(
352
+ Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::TelegramConfig,
353
+ Dodopayments::Internal::AnyHash
354
+ )
355
+ end
356
+
357
+ sig { returns(String) }
358
+ attr_accessor :chat_id
359
+
360
+ sig { params(chat_id: String).returns(T.attached_class) }
361
+ def self.new(chat_id:)
362
+ end
363
+
364
+ sig { override.returns({ chat_id: String }) }
365
+ def to_hash
366
+ end
367
+ end
368
+
369
+ class FigmaConfig < Dodopayments::Internal::Type::BaseModel
370
+ OrHash =
371
+ T.type_alias do
372
+ T.any(
373
+ Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::FigmaConfig,
374
+ Dodopayments::Internal::AnyHash
375
+ )
376
+ end
377
+
378
+ sig { returns(String) }
379
+ attr_accessor :figma_file_id
380
+
381
+ sig { params(figma_file_id: String).returns(T.attached_class) }
382
+ def self.new(figma_file_id:)
383
+ end
384
+
385
+ sig { override.returns({ figma_file_id: String }) }
386
+ def to_hash
387
+ end
388
+ end
389
+
390
+ class FramerConfig < Dodopayments::Internal::Type::BaseModel
391
+ OrHash =
392
+ T.type_alias do
393
+ T.any(
394
+ Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::FramerConfig,
395
+ Dodopayments::Internal::AnyHash
396
+ )
397
+ end
398
+
399
+ sig { returns(String) }
400
+ attr_accessor :framer_template_id
401
+
402
+ sig { params(framer_template_id: String).returns(T.attached_class) }
403
+ def self.new(framer_template_id:)
404
+ end
405
+
406
+ sig { override.returns({ framer_template_id: String }) }
407
+ def to_hash
408
+ end
409
+ end
410
+
411
+ class NotionConfig < Dodopayments::Internal::Type::BaseModel
412
+ OrHash =
413
+ T.type_alias do
414
+ T.any(
415
+ Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::NotionConfig,
416
+ Dodopayments::Internal::AnyHash
417
+ )
418
+ end
419
+
420
+ sig { returns(String) }
421
+ attr_accessor :notion_template_id
422
+
423
+ sig { params(notion_template_id: String).returns(T.attached_class) }
424
+ def self.new(notion_template_id:)
425
+ end
426
+
427
+ sig { override.returns({ notion_template_id: String }) }
428
+ def to_hash
429
+ end
430
+ end
431
+
432
+ class DigitalFilesConfig < Dodopayments::Internal::Type::BaseModel
433
+ OrHash =
434
+ T.type_alias do
435
+ T.any(
436
+ Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::DigitalFilesConfig,
437
+ Dodopayments::Internal::AnyHash
438
+ )
439
+ end
440
+
441
+ sig { returns(T::Array[String]) }
442
+ attr_accessor :digital_file_ids
443
+
444
+ sig { returns(T.nilable(String)) }
445
+ attr_accessor :external_url
446
+
447
+ sig { returns(T.nilable(String)) }
448
+ attr_accessor :instructions
449
+
450
+ sig do
451
+ params(
452
+ digital_file_ids: T::Array[String],
453
+ external_url: T.nilable(String),
454
+ instructions: T.nilable(String)
455
+ ).returns(T.attached_class)
456
+ end
457
+ def self.new(
458
+ digital_file_ids:,
459
+ external_url: nil,
460
+ instructions: nil
461
+ )
462
+ end
463
+
464
+ sig do
465
+ override.returns(
466
+ {
467
+ digital_file_ids: T::Array[String],
468
+ external_url: T.nilable(String),
469
+ instructions: T.nilable(String)
470
+ }
471
+ )
472
+ end
473
+ def to_hash
474
+ end
475
+ end
476
+
477
+ class LicenseKeyConfig < Dodopayments::Internal::Type::BaseModel
478
+ OrHash =
479
+ T.type_alias do
480
+ T.any(
481
+ Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::LicenseKeyConfig,
482
+ Dodopayments::Internal::AnyHash
483
+ )
484
+ end
485
+
486
+ sig { returns(T.nilable(String)) }
487
+ attr_accessor :activation_message
488
+
489
+ sig { returns(T.nilable(Integer)) }
490
+ attr_accessor :activations_limit
491
+
492
+ sig { returns(T.nilable(Integer)) }
493
+ attr_accessor :duration_count
494
+
495
+ sig { returns(T.nilable(String)) }
496
+ attr_accessor :duration_interval
497
+
498
+ sig do
499
+ params(
500
+ activation_message: T.nilable(String),
501
+ activations_limit: T.nilable(Integer),
502
+ duration_count: T.nilable(Integer),
503
+ duration_interval: T.nilable(String)
504
+ ).returns(T.attached_class)
505
+ end
506
+ def self.new(
507
+ activation_message: nil,
508
+ activations_limit: nil,
509
+ duration_count: nil,
510
+ duration_interval: nil
511
+ )
512
+ end
513
+
514
+ sig do
515
+ override.returns(
516
+ {
517
+ activation_message: T.nilable(String),
518
+ activations_limit: T.nilable(Integer),
519
+ duration_count: T.nilable(Integer),
520
+ duration_interval: T.nilable(String)
521
+ }
522
+ )
523
+ end
524
+ def to_hash
525
+ end
526
+ end
527
+
528
+ sig do
529
+ override.returns(
530
+ T::Array[
531
+ Dodopayments::Models::ProductListResponse::Entitlement::IntegrationConfig::Variants
532
+ ]
533
+ )
534
+ end
535
+ def self.variants
536
+ end
537
+ end
538
+
539
+ module IntegrationType
540
+ extend Dodopayments::Internal::Type::Enum
541
+
542
+ TaggedSymbol =
543
+ T.type_alias do
544
+ T.all(
545
+ Symbol,
546
+ Dodopayments::Models::ProductListResponse::Entitlement::IntegrationType
547
+ )
548
+ end
549
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
550
+
551
+ DISCORD =
552
+ T.let(
553
+ :discord,
554
+ Dodopayments::Models::ProductListResponse::Entitlement::IntegrationType::TaggedSymbol
555
+ )
556
+ TELEGRAM =
557
+ T.let(
558
+ :telegram,
559
+ Dodopayments::Models::ProductListResponse::Entitlement::IntegrationType::TaggedSymbol
560
+ )
561
+ GITHUB =
562
+ T.let(
563
+ :github,
564
+ Dodopayments::Models::ProductListResponse::Entitlement::IntegrationType::TaggedSymbol
565
+ )
566
+ FIGMA =
567
+ T.let(
568
+ :figma,
569
+ Dodopayments::Models::ProductListResponse::Entitlement::IntegrationType::TaggedSymbol
570
+ )
571
+ FRAMER =
572
+ T.let(
573
+ :framer,
574
+ Dodopayments::Models::ProductListResponse::Entitlement::IntegrationType::TaggedSymbol
575
+ )
576
+ NOTION =
577
+ T.let(
578
+ :notion,
579
+ Dodopayments::Models::ProductListResponse::Entitlement::IntegrationType::TaggedSymbol
580
+ )
581
+ DIGITAL_FILES =
582
+ T.let(
583
+ :digital_files,
584
+ Dodopayments::Models::ProductListResponse::Entitlement::IntegrationType::TaggedSymbol
585
+ )
586
+ LICENSE_KEY =
587
+ T.let(
588
+ :license_key,
589
+ Dodopayments::Models::ProductListResponse::Entitlement::IntegrationType::TaggedSymbol
590
+ )
591
+
592
+ sig do
593
+ override.returns(
594
+ T::Array[
595
+ Dodopayments::Models::ProductListResponse::Entitlement::IntegrationType::TaggedSymbol
596
+ ]
597
+ )
598
+ end
599
+ def self.values
600
+ end
601
+ end
602
+ end
167
603
  end
168
604
  end
169
605
  end
@@ -53,6 +53,11 @@ module Dodopayments
53
53
  end
54
54
  attr_writer :digital_product_delivery
55
55
 
56
+ # Entitlement IDs to attach (replaces all existing when present) Send empty array
57
+ # to remove all, omit field to leave unchanged
58
+ sig { returns(T.nilable(T::Array[String])) }
59
+ attr_accessor :entitlement_ids
60
+
56
61
  # Product image id after its uploaded to S3
57
62
  sig { returns(T.nilable(String)) }
58
63
  attr_accessor :image_id
@@ -131,6 +136,7 @@ module Dodopayments
131
136
  T.nilable(
132
137
  Dodopayments::ProductUpdateParams::DigitalProductDelivery::OrHash
133
138
  ),
139
+ entitlement_ids: T.nilable(T::Array[String]),
134
140
  image_id: T.nilable(String),
135
141
  license_key_activation_message: T.nilable(String),
136
142
  license_key_activations_limit: T.nilable(Integer),
@@ -163,6 +169,9 @@ module Dodopayments
163
169
  description: nil,
164
170
  # Choose how you would like you digital product delivered
165
171
  digital_product_delivery: nil,
172
+ # Entitlement IDs to attach (replaces all existing when present) Send empty array
173
+ # to remove all, omit field to leave unchanged
174
+ entitlement_ids: nil,
166
175
  # Product image id after its uploaded to S3
167
176
  image_id: nil,
168
177
  # Message sent to the customer upon license key activation.
@@ -210,6 +219,7 @@ module Dodopayments
210
219
  T.nilable(
211
220
  Dodopayments::ProductUpdateParams::DigitalProductDelivery
212
221
  ),
222
+ entitlement_ids: T.nilable(T::Array[String]),
213
223
  image_id: T.nilable(String),
214
224
  license_key_activation_message: T.nilable(String),
215
225
  license_key_activations_limit: T.nilable(Integer),
@@ -164,6 +164,26 @@ module Dodopayments
164
164
  T.let(:"acr.email", Dodopayments::WebhookEventType::TaggedSymbol)
165
165
  DUNNING_EMAIL =
166
166
  T.let(:"dunning.email", Dodopayments::WebhookEventType::TaggedSymbol)
167
+ ENTITLEMENT_GRANT_CREATED =
168
+ T.let(
169
+ :"entitlement_grant.created",
170
+ Dodopayments::WebhookEventType::TaggedSymbol
171
+ )
172
+ ENTITLEMENT_GRANT_DELIVERED =
173
+ T.let(
174
+ :"entitlement_grant.delivered",
175
+ Dodopayments::WebhookEventType::TaggedSymbol
176
+ )
177
+ ENTITLEMENT_GRANT_FAILED =
178
+ T.let(
179
+ :"entitlement_grant.failed",
180
+ Dodopayments::WebhookEventType::TaggedSymbol
181
+ )
182
+ ENTITLEMENT_GRANT_REVOKED =
183
+ T.let(
184
+ :"entitlement_grant.revoked",
185
+ Dodopayments::WebhookEventType::TaggedSymbol
186
+ )
167
187
 
168
188
  sig do
169
189
  override.returns(T::Array[Dodopayments::WebhookEventType::TaggedSymbol])