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
@@ -32,14 +32,15 @@ module Dodopayments
32
32
  sig { returns(String) }
33
33
  attr_accessor :key
34
34
 
35
- # The unique identifier of the payment associated with the license key.
36
- sig { returns(String) }
37
- attr_accessor :payment_id
38
-
39
35
  # The unique identifier of the product associated with the license key.
40
36
  sig { returns(String) }
41
37
  attr_accessor :product_id
42
38
 
39
+ # The source of the license key - 'auto' for keys generated by
40
+ # payment/subscription flows, 'import' for merchant-imported keys.
41
+ sig { returns(Dodopayments::LicenseKey::Source::TaggedSymbol) }
42
+ attr_accessor :source
43
+
43
44
  # The current status of the license key (e.g., active, inactive, expired).
44
45
  sig { returns(Dodopayments::LicenseKeyStatus::TaggedSymbol) }
45
46
  attr_accessor :status
@@ -52,6 +53,10 @@ module Dodopayments
52
53
  sig { returns(T.nilable(Time)) }
53
54
  attr_accessor :expires_at
54
55
 
56
+ # The unique identifier of the payment associated with the license key, if any.
57
+ sig { returns(T.nilable(String)) }
58
+ attr_accessor :payment_id
59
+
55
60
  # The unique identifier of the subscription associated with the license key, if
56
61
  # any.
57
62
  sig { returns(T.nilable(String)) }
@@ -65,11 +70,12 @@ module Dodopayments
65
70
  customer_id: String,
66
71
  instances_count: Integer,
67
72
  key: String,
68
- payment_id: String,
69
73
  product_id: String,
74
+ source: Dodopayments::LicenseKey::Source::OrSymbol,
70
75
  status: Dodopayments::LicenseKeyStatus::OrSymbol,
71
76
  activations_limit: T.nilable(Integer),
72
77
  expires_at: T.nilable(Time),
78
+ payment_id: T.nilable(String),
73
79
  subscription_id: T.nilable(String)
74
80
  ).returns(T.attached_class)
75
81
  end
@@ -86,16 +92,19 @@ module Dodopayments
86
92
  instances_count:,
87
93
  # The license key string.
88
94
  key:,
89
- # The unique identifier of the payment associated with the license key.
90
- payment_id:,
91
95
  # The unique identifier of the product associated with the license key.
92
96
  product_id:,
97
+ # The source of the license key - 'auto' for keys generated by
98
+ # payment/subscription flows, 'import' for merchant-imported keys.
99
+ source:,
93
100
  # The current status of the license key (e.g., active, inactive, expired).
94
101
  status:,
95
102
  # The maximum number of activations allowed for this license key.
96
103
  activations_limit: nil,
97
104
  # The timestamp indicating when the license key expires, in UTC.
98
105
  expires_at: nil,
106
+ # The unique identifier of the payment associated with the license key, if any.
107
+ payment_id: nil,
99
108
  # The unique identifier of the subscription associated with the license key, if
100
109
  # any.
101
110
  subscription_id: nil
@@ -111,17 +120,39 @@ module Dodopayments
111
120
  customer_id: String,
112
121
  instances_count: Integer,
113
122
  key: String,
114
- payment_id: String,
115
123
  product_id: String,
124
+ source: Dodopayments::LicenseKey::Source::TaggedSymbol,
116
125
  status: Dodopayments::LicenseKeyStatus::TaggedSymbol,
117
126
  activations_limit: T.nilable(Integer),
118
127
  expires_at: T.nilable(Time),
128
+ payment_id: T.nilable(String),
119
129
  subscription_id: T.nilable(String)
120
130
  }
121
131
  )
122
132
  end
123
133
  def to_hash
124
134
  end
135
+
136
+ # The source of the license key - 'auto' for keys generated by
137
+ # payment/subscription flows, 'import' for merchant-imported keys.
138
+ module Source
139
+ extend Dodopayments::Internal::Type::Enum
140
+
141
+ TaggedSymbol =
142
+ T.type_alias { T.all(Symbol, Dodopayments::LicenseKey::Source) }
143
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
144
+
145
+ AUTO = T.let(:auto, Dodopayments::LicenseKey::Source::TaggedSymbol)
146
+ IMPORT = T.let(:import, Dodopayments::LicenseKey::Source::TaggedSymbol)
147
+
148
+ sig do
149
+ override.returns(
150
+ T::Array[Dodopayments::LicenseKey::Source::TaggedSymbol]
151
+ )
152
+ end
153
+ def self.values
154
+ end
155
+ end
125
156
  end
126
157
  end
127
158
  end
@@ -0,0 +1,78 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ class LicenseKeyCreateParams < Dodopayments::Internal::Type::BaseModel
6
+ extend Dodopayments::Internal::Type::RequestParameters::Converter
7
+ include Dodopayments::Internal::Type::RequestParameters
8
+
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(
12
+ Dodopayments::LicenseKeyCreateParams,
13
+ Dodopayments::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ # The customer this license key belongs to.
18
+ sig { returns(String) }
19
+ attr_accessor :customer_id
20
+
21
+ # The license key string to import.
22
+ sig { returns(String) }
23
+ attr_accessor :key
24
+
25
+ # The product this license key is for.
26
+ sig { returns(String) }
27
+ attr_accessor :product_id
28
+
29
+ # Maximum number of activations allowed. Null means unlimited.
30
+ sig { returns(T.nilable(Integer)) }
31
+ attr_accessor :activations_limit
32
+
33
+ # Expiration timestamp. Null means the key never expires.
34
+ sig { returns(T.nilable(Time)) }
35
+ attr_accessor :expires_at
36
+
37
+ sig do
38
+ params(
39
+ customer_id: String,
40
+ key: String,
41
+ product_id: String,
42
+ activations_limit: T.nilable(Integer),
43
+ expires_at: T.nilable(Time),
44
+ request_options: Dodopayments::RequestOptions::OrHash
45
+ ).returns(T.attached_class)
46
+ end
47
+ def self.new(
48
+ # The customer this license key belongs to.
49
+ customer_id:,
50
+ # The license key string to import.
51
+ key:,
52
+ # The product this license key is for.
53
+ product_id:,
54
+ # Maximum number of activations allowed. Null means unlimited.
55
+ activations_limit: nil,
56
+ # Expiration timestamp. Null means the key never expires.
57
+ expires_at: nil,
58
+ request_options: {}
59
+ )
60
+ end
61
+
62
+ sig do
63
+ override.returns(
64
+ {
65
+ customer_id: String,
66
+ key: String,
67
+ product_id: String,
68
+ activations_limit: T.nilable(Integer),
69
+ expires_at: T.nilable(Time),
70
+ request_options: Dodopayments::RequestOptions
71
+ }
72
+ )
73
+ end
74
+ def to_hash
75
+ end
76
+ end
77
+ end
78
+ end
@@ -56,6 +56,19 @@ module Dodopayments
56
56
  sig { params(product_id: String).void }
57
57
  attr_writer :product_id
58
58
 
59
+ # Filter by license key source
60
+ sig do
61
+ returns(T.nilable(Dodopayments::LicenseKeyListParams::Source::OrSymbol))
62
+ end
63
+ attr_reader :source
64
+
65
+ sig do
66
+ params(
67
+ source: Dodopayments::LicenseKeyListParams::Source::OrSymbol
68
+ ).void
69
+ end
70
+ attr_writer :source
71
+
59
72
  # Filter by license key status
60
73
  sig do
61
74
  returns(T.nilable(Dodopayments::LicenseKeyListParams::Status::OrSymbol))
@@ -77,6 +90,7 @@ module Dodopayments
77
90
  page_number: Integer,
78
91
  page_size: Integer,
79
92
  product_id: String,
93
+ source: Dodopayments::LicenseKeyListParams::Source::OrSymbol,
80
94
  status: Dodopayments::LicenseKeyListParams::Status::OrSymbol,
81
95
  request_options: Dodopayments::RequestOptions::OrHash
82
96
  ).returns(T.attached_class)
@@ -94,6 +108,8 @@ module Dodopayments
94
108
  page_size: nil,
95
109
  # Filter by product ID
96
110
  product_id: nil,
111
+ # Filter by license key source
112
+ source: nil,
97
113
  # Filter by license key status
98
114
  status: nil,
99
115
  request_options: {}
@@ -109,6 +125,7 @@ module Dodopayments
109
125
  page_number: Integer,
110
126
  page_size: Integer,
111
127
  product_id: String,
128
+ source: Dodopayments::LicenseKeyListParams::Source::OrSymbol,
112
129
  status: Dodopayments::LicenseKeyListParams::Status::OrSymbol,
113
130
  request_options: Dodopayments::RequestOptions
114
131
  }
@@ -117,6 +134,33 @@ module Dodopayments
117
134
  def to_hash
118
135
  end
119
136
 
137
+ # Filter by license key source
138
+ module Source
139
+ extend Dodopayments::Internal::Type::Enum
140
+
141
+ TaggedSymbol =
142
+ T.type_alias do
143
+ T.all(Symbol, Dodopayments::LicenseKeyListParams::Source)
144
+ end
145
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
146
+
147
+ AUTO =
148
+ T.let(:auto, Dodopayments::LicenseKeyListParams::Source::TaggedSymbol)
149
+ IMPORT =
150
+ T.let(
151
+ :import,
152
+ Dodopayments::LicenseKeyListParams::Source::TaggedSymbol
153
+ )
154
+
155
+ sig do
156
+ override.returns(
157
+ T::Array[Dodopayments::LicenseKeyListParams::Source::TaggedSymbol]
158
+ )
159
+ end
160
+ def self.values
161
+ end
162
+ end
163
+
120
164
  # Filter by license key status
121
165
  module Status
122
166
  extend Dodopayments::Internal::Type::Enum