whop_sdk 0.0.5 → 0.0.6

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 (60) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -0
  3. data/README.md +4 -7
  4. data/lib/whop_sdk/client.rb +17 -6
  5. data/lib/whop_sdk/models/company.rb +1 -0
  6. data/lib/whop_sdk/models/dispute.rb +672 -0
  7. data/lib/whop_sdk/models/dispute_created_webhook_event.rb +48 -0
  8. data/lib/whop_sdk/models/dispute_list_params.rb +62 -0
  9. data/lib/whop_sdk/models/dispute_list_response.rb +187 -0
  10. data/lib/whop_sdk/models/dispute_retrieve_params.rb +14 -0
  11. data/lib/whop_sdk/models/dispute_statuses.rb +23 -0
  12. data/lib/whop_sdk/models/dispute_submit_evidence_params.rb +14 -0
  13. data/lib/whop_sdk/models/dispute_update_evidence_params.rb +342 -0
  14. data/lib/whop_sdk/models/dispute_updated_webhook_event.rb +48 -0
  15. data/lib/whop_sdk/models/notification_create_params.rb +88 -0
  16. data/lib/whop_sdk/models/notification_create_response.rb +19 -0
  17. data/lib/whop_sdk/models/unwrap_webhook_event.rb +5 -1
  18. data/lib/whop_sdk/models.rb +18 -0
  19. data/lib/whop_sdk/resources/disputes.rb +182 -0
  20. data/lib/whop_sdk/resources/notifications.rb +53 -0
  21. data/lib/whop_sdk/resources/webhooks.rb +1 -1
  22. data/lib/whop_sdk/version.rb +1 -1
  23. data/lib/whop_sdk.rb +13 -0
  24. data/rbi/whop_sdk/client.rbi +11 -2
  25. data/rbi/whop_sdk/models/company.rbi +2 -0
  26. data/rbi/whop_sdk/models/dispute.rbi +938 -0
  27. data/rbi/whop_sdk/models/dispute_created_webhook_event.rbi +72 -0
  28. data/rbi/whop_sdk/models/dispute_list_params.rbi +83 -0
  29. data/rbi/whop_sdk/models/dispute_list_response.rbi +287 -0
  30. data/rbi/whop_sdk/models/dispute_retrieve_params.rbi +27 -0
  31. data/rbi/whop_sdk/models/dispute_statuses.rbi +32 -0
  32. data/rbi/whop_sdk/models/dispute_submit_evidence_params.rbi +30 -0
  33. data/rbi/whop_sdk/models/dispute_update_evidence_params.rbi +566 -0
  34. data/rbi/whop_sdk/models/dispute_updated_webhook_event.rbi +72 -0
  35. data/rbi/whop_sdk/models/notification_create_params.rbi +113 -0
  36. data/rbi/whop_sdk/models/notification_create_response.rbi +31 -0
  37. data/rbi/whop_sdk/models/unwrap_webhook_event.rbi +3 -1
  38. data/rbi/whop_sdk/models.rbi +18 -0
  39. data/rbi/whop_sdk/resources/disputes.rbi +194 -0
  40. data/rbi/whop_sdk/resources/notifications.rbi +54 -0
  41. data/rbi/whop_sdk/resources/webhooks.rbi +3 -1
  42. data/sig/whop_sdk/client.rbs +5 -1
  43. data/sig/whop_sdk/models/company.rbs +2 -0
  44. data/sig/whop_sdk/models/dispute.rbs +437 -0
  45. data/sig/whop_sdk/models/dispute_created_webhook_event.rbs +40 -0
  46. data/sig/whop_sdk/models/dispute_list_params.rbs +51 -0
  47. data/sig/whop_sdk/models/dispute_list_response.rbs +124 -0
  48. data/sig/whop_sdk/models/dispute_retrieve_params.rbs +15 -0
  49. data/sig/whop_sdk/models/dispute_statuses.rbs +30 -0
  50. data/sig/whop_sdk/models/dispute_submit_evidence_params.rbs +15 -0
  51. data/sig/whop_sdk/models/dispute_update_evidence_params.rbs +215 -0
  52. data/sig/whop_sdk/models/dispute_updated_webhook_event.rbs +40 -0
  53. data/sig/whop_sdk/models/notification_create_params.rbs +61 -0
  54. data/sig/whop_sdk/models/notification_create_response.rbs +13 -0
  55. data/sig/whop_sdk/models/unwrap_webhook_event.rbs +2 -0
  56. data/sig/whop_sdk/models.rbs +18 -0
  57. data/sig/whop_sdk/resources/disputes.rbs +46 -0
  58. data/sig/whop_sdk/resources/notifications.rbs +19 -0
  59. data/sig/whop_sdk/resources/webhooks.rbs +3 -1
  60. metadata +41 -2
@@ -0,0 +1,72 @@
1
+ # typed: strong
2
+
3
+ module WhopSDK
4
+ module Models
5
+ class DisputeCreatedWebhookEvent < WhopSDK::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(WhopSDK::DisputeCreatedWebhookEvent, WhopSDK::Internal::AnyHash)
9
+ end
10
+
11
+ # A unique ID for every single webhook request
12
+ sig { returns(String) }
13
+ attr_accessor :id
14
+
15
+ # The API version for this webhook
16
+ sig { returns(Symbol) }
17
+ attr_accessor :api_version
18
+
19
+ # An object representing a dispute against a company.
20
+ sig { returns(WhopSDK::Dispute) }
21
+ attr_reader :data
22
+
23
+ sig { params(data: WhopSDK::Dispute::OrHash).void }
24
+ attr_writer :data
25
+
26
+ # The timestamp in ISO 8601 format that the webhook was sent at on the server
27
+ sig { returns(Time) }
28
+ attr_accessor :timestamp
29
+
30
+ # The webhook event type
31
+ sig { returns(Symbol) }
32
+ attr_accessor :type
33
+
34
+ sig do
35
+ params(
36
+ id: String,
37
+ data: WhopSDK::Dispute::OrHash,
38
+ timestamp: Time,
39
+ api_version: Symbol,
40
+ type: Symbol
41
+ ).returns(T.attached_class)
42
+ end
43
+ def self.new(
44
+ # A unique ID for every single webhook request
45
+ id:,
46
+ # An object representing a dispute against a company.
47
+ data:,
48
+ # The timestamp in ISO 8601 format that the webhook was sent at on the server
49
+ timestamp:,
50
+ # The API version for this webhook
51
+ api_version: :v1,
52
+ # The webhook event type
53
+ type: :"dispute.created"
54
+ )
55
+ end
56
+
57
+ sig do
58
+ override.returns(
59
+ {
60
+ id: String,
61
+ api_version: Symbol,
62
+ data: WhopSDK::Dispute,
63
+ timestamp: Time,
64
+ type: Symbol
65
+ }
66
+ )
67
+ end
68
+ def to_hash
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,83 @@
1
+ # typed: strong
2
+
3
+ module WhopSDK
4
+ module Models
5
+ class DisputeListParams < WhopSDK::Internal::Type::BaseModel
6
+ extend WhopSDK::Internal::Type::RequestParameters::Converter
7
+ include WhopSDK::Internal::Type::RequestParameters
8
+
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(WhopSDK::DisputeListParams, WhopSDK::Internal::AnyHash)
12
+ end
13
+
14
+ # The ID of the company to list disputes for
15
+ sig { returns(String) }
16
+ attr_accessor :company_id
17
+
18
+ # Returns the elements in the list that come after the specified cursor.
19
+ sig { returns(T.nilable(String)) }
20
+ attr_accessor :after
21
+
22
+ # Returns the elements in the list that come before the specified cursor.
23
+ sig { returns(T.nilable(String)) }
24
+ attr_accessor :before
25
+
26
+ # The direction of the sort.
27
+ sig { returns(T.nilable(WhopSDK::Direction::OrSymbol)) }
28
+ attr_accessor :direction
29
+
30
+ # Returns the first _n_ elements from the list.
31
+ sig { returns(T.nilable(Integer)) }
32
+ attr_accessor :first
33
+
34
+ # Returns the last _n_ elements from the list.
35
+ sig { returns(T.nilable(Integer)) }
36
+ attr_accessor :last
37
+
38
+ sig do
39
+ params(
40
+ company_id: String,
41
+ after: T.nilable(String),
42
+ before: T.nilable(String),
43
+ direction: T.nilable(WhopSDK::Direction::OrSymbol),
44
+ first: T.nilable(Integer),
45
+ last: T.nilable(Integer),
46
+ request_options: WhopSDK::RequestOptions::OrHash
47
+ ).returns(T.attached_class)
48
+ end
49
+ def self.new(
50
+ # The ID of the company to list disputes for
51
+ company_id:,
52
+ # Returns the elements in the list that come after the specified cursor.
53
+ after: nil,
54
+ # Returns the elements in the list that come before the specified cursor.
55
+ before: nil,
56
+ # The direction of the sort.
57
+ direction: nil,
58
+ # Returns the first _n_ elements from the list.
59
+ first: nil,
60
+ # Returns the last _n_ elements from the list.
61
+ last: nil,
62
+ request_options: {}
63
+ )
64
+ end
65
+
66
+ sig do
67
+ override.returns(
68
+ {
69
+ company_id: String,
70
+ after: T.nilable(String),
71
+ before: T.nilable(String),
72
+ direction: T.nilable(WhopSDK::Direction::OrSymbol),
73
+ first: T.nilable(Integer),
74
+ last: T.nilable(Integer),
75
+ request_options: WhopSDK::RequestOptions
76
+ }
77
+ )
78
+ end
79
+ def to_hash
80
+ end
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,287 @@
1
+ # typed: strong
2
+
3
+ module WhopSDK
4
+ module Models
5
+ class DisputeListResponse < WhopSDK::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ WhopSDK::Models::DisputeListResponse,
10
+ WhopSDK::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ # The internal ID of the dispute.
15
+ sig { returns(String) }
16
+ attr_accessor :id
17
+
18
+ # The amount of the dispute (formatted).
19
+ sig { returns(Float) }
20
+ attr_accessor :amount
21
+
22
+ # The company the dispute is against.
23
+ sig { returns(T.nilable(WhopSDK::Models::DisputeListResponse::Company)) }
24
+ attr_reader :company
25
+
26
+ sig do
27
+ params(
28
+ company:
29
+ T.nilable(WhopSDK::Models::DisputeListResponse::Company::OrHash)
30
+ ).void
31
+ end
32
+ attr_writer :company
33
+
34
+ # When it was made.
35
+ sig { returns(T.nilable(Time)) }
36
+ attr_accessor :created_at
37
+
38
+ # The currency of the dispute.
39
+ sig { returns(WhopSDK::Currency::TaggedSymbol) }
40
+ attr_accessor :currency
41
+
42
+ # Whether or not the dispute data can be edited.
43
+ sig { returns(T.nilable(T::Boolean)) }
44
+ attr_accessor :editable
45
+
46
+ # The last date the dispute is allow to be submitted by.
47
+ sig { returns(T.nilable(Time)) }
48
+ attr_accessor :needs_response_by
49
+
50
+ # The payment that got disputed
51
+ sig { returns(T.nilable(WhopSDK::Models::DisputeListResponse::Payment)) }
52
+ attr_reader :payment
53
+
54
+ sig do
55
+ params(
56
+ payment:
57
+ T.nilable(WhopSDK::Models::DisputeListResponse::Payment::OrHash)
58
+ ).void
59
+ end
60
+ attr_writer :payment
61
+
62
+ # The plan that got disputed
63
+ sig { returns(T.nilable(WhopSDK::Models::DisputeListResponse::Plan)) }
64
+ attr_reader :plan
65
+
66
+ sig do
67
+ params(
68
+ plan: T.nilable(WhopSDK::Models::DisputeListResponse::Plan::OrHash)
69
+ ).void
70
+ end
71
+ attr_writer :plan
72
+
73
+ # The product that got disputed
74
+ sig { returns(T.nilable(WhopSDK::Models::DisputeListResponse::Product)) }
75
+ attr_reader :product
76
+
77
+ sig do
78
+ params(
79
+ product:
80
+ T.nilable(WhopSDK::Models::DisputeListResponse::Product::OrHash)
81
+ ).void
82
+ end
83
+ attr_writer :product
84
+
85
+ # The reason for the dispute
86
+ sig { returns(T.nilable(String)) }
87
+ attr_accessor :reason
88
+
89
+ # The status of the dispute (mimics stripe's dispute status).
90
+ sig { returns(WhopSDK::DisputeStatuses::TaggedSymbol) }
91
+ attr_accessor :status
92
+
93
+ # Whether or not the dispute is a Visa Rapid Dispute Resolution.
94
+ sig { returns(T::Boolean) }
95
+ attr_accessor :visa_rdr
96
+
97
+ # An object representing a dispute against a company.
98
+ sig do
99
+ params(
100
+ id: String,
101
+ amount: Float,
102
+ company:
103
+ T.nilable(WhopSDK::Models::DisputeListResponse::Company::OrHash),
104
+ created_at: T.nilable(Time),
105
+ currency: WhopSDK::Currency::OrSymbol,
106
+ editable: T.nilable(T::Boolean),
107
+ needs_response_by: T.nilable(Time),
108
+ payment:
109
+ T.nilable(WhopSDK::Models::DisputeListResponse::Payment::OrHash),
110
+ plan: T.nilable(WhopSDK::Models::DisputeListResponse::Plan::OrHash),
111
+ product:
112
+ T.nilable(WhopSDK::Models::DisputeListResponse::Product::OrHash),
113
+ reason: T.nilable(String),
114
+ status: WhopSDK::DisputeStatuses::OrSymbol,
115
+ visa_rdr: T::Boolean
116
+ ).returns(T.attached_class)
117
+ end
118
+ def self.new(
119
+ # The internal ID of the dispute.
120
+ id:,
121
+ # The amount of the dispute (formatted).
122
+ amount:,
123
+ # The company the dispute is against.
124
+ company:,
125
+ # When it was made.
126
+ created_at:,
127
+ # The currency of the dispute.
128
+ currency:,
129
+ # Whether or not the dispute data can be edited.
130
+ editable:,
131
+ # The last date the dispute is allow to be submitted by.
132
+ needs_response_by:,
133
+ # The payment that got disputed
134
+ payment:,
135
+ # The plan that got disputed
136
+ plan:,
137
+ # The product that got disputed
138
+ product:,
139
+ # The reason for the dispute
140
+ reason:,
141
+ # The status of the dispute (mimics stripe's dispute status).
142
+ status:,
143
+ # Whether or not the dispute is a Visa Rapid Dispute Resolution.
144
+ visa_rdr:
145
+ )
146
+ end
147
+
148
+ sig do
149
+ override.returns(
150
+ {
151
+ id: String,
152
+ amount: Float,
153
+ company: T.nilable(WhopSDK::Models::DisputeListResponse::Company),
154
+ created_at: T.nilable(Time),
155
+ currency: WhopSDK::Currency::TaggedSymbol,
156
+ editable: T.nilable(T::Boolean),
157
+ needs_response_by: T.nilable(Time),
158
+ payment: T.nilable(WhopSDK::Models::DisputeListResponse::Payment),
159
+ plan: T.nilable(WhopSDK::Models::DisputeListResponse::Plan),
160
+ product: T.nilable(WhopSDK::Models::DisputeListResponse::Product),
161
+ reason: T.nilable(String),
162
+ status: WhopSDK::DisputeStatuses::TaggedSymbol,
163
+ visa_rdr: T::Boolean
164
+ }
165
+ )
166
+ end
167
+ def to_hash
168
+ end
169
+
170
+ class Company < WhopSDK::Internal::Type::BaseModel
171
+ OrHash =
172
+ T.type_alias do
173
+ T.any(
174
+ WhopSDK::Models::DisputeListResponse::Company,
175
+ WhopSDK::Internal::AnyHash
176
+ )
177
+ end
178
+
179
+ # The ID of the company
180
+ sig { returns(String) }
181
+ attr_accessor :id
182
+
183
+ # The written name of the company.
184
+ sig { returns(String) }
185
+ attr_accessor :title
186
+
187
+ # The company the dispute is against.
188
+ sig { params(id: String, title: String).returns(T.attached_class) }
189
+ def self.new(
190
+ # The ID of the company
191
+ id:,
192
+ # The written name of the company.
193
+ title:
194
+ )
195
+ end
196
+
197
+ sig { override.returns({ id: String, title: String }) }
198
+ def to_hash
199
+ end
200
+ end
201
+
202
+ class Payment < WhopSDK::Internal::Type::BaseModel
203
+ OrHash =
204
+ T.type_alias do
205
+ T.any(
206
+ WhopSDK::Models::DisputeListResponse::Payment,
207
+ WhopSDK::Internal::AnyHash
208
+ )
209
+ end
210
+
211
+ # The payment ID
212
+ sig { returns(String) }
213
+ attr_accessor :id
214
+
215
+ # The payment that got disputed
216
+ sig { params(id: String).returns(T.attached_class) }
217
+ def self.new(
218
+ # The payment ID
219
+ id:
220
+ )
221
+ end
222
+
223
+ sig { override.returns({ id: String }) }
224
+ def to_hash
225
+ end
226
+ end
227
+
228
+ class Plan < WhopSDK::Internal::Type::BaseModel
229
+ OrHash =
230
+ T.type_alias do
231
+ T.any(
232
+ WhopSDK::Models::DisputeListResponse::Plan,
233
+ WhopSDK::Internal::AnyHash
234
+ )
235
+ end
236
+
237
+ # The internal ID of the plan.
238
+ sig { returns(String) }
239
+ attr_accessor :id
240
+
241
+ # The plan that got disputed
242
+ sig { params(id: String).returns(T.attached_class) }
243
+ def self.new(
244
+ # The internal ID of the plan.
245
+ id:
246
+ )
247
+ end
248
+
249
+ sig { override.returns({ id: String }) }
250
+ def to_hash
251
+ end
252
+ end
253
+
254
+ class Product < WhopSDK::Internal::Type::BaseModel
255
+ OrHash =
256
+ T.type_alias do
257
+ T.any(
258
+ WhopSDK::Models::DisputeListResponse::Product,
259
+ WhopSDK::Internal::AnyHash
260
+ )
261
+ end
262
+
263
+ # The internal ID of the public product.
264
+ sig { returns(String) }
265
+ attr_accessor :id
266
+
267
+ # The title of the product. Use for Whop 4.0.
268
+ sig { returns(String) }
269
+ attr_accessor :title
270
+
271
+ # The product that got disputed
272
+ sig { params(id: String, title: String).returns(T.attached_class) }
273
+ def self.new(
274
+ # The internal ID of the public product.
275
+ id:,
276
+ # The title of the product. Use for Whop 4.0.
277
+ title:
278
+ )
279
+ end
280
+
281
+ sig { override.returns({ id: String, title: String }) }
282
+ def to_hash
283
+ end
284
+ end
285
+ end
286
+ end
287
+ end
@@ -0,0 +1,27 @@
1
+ # typed: strong
2
+
3
+ module WhopSDK
4
+ module Models
5
+ class DisputeRetrieveParams < WhopSDK::Internal::Type::BaseModel
6
+ extend WhopSDK::Internal::Type::RequestParameters::Converter
7
+ include WhopSDK::Internal::Type::RequestParameters
8
+
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(WhopSDK::DisputeRetrieveParams, WhopSDK::Internal::AnyHash)
12
+ end
13
+
14
+ sig do
15
+ params(request_options: WhopSDK::RequestOptions::OrHash).returns(
16
+ T.attached_class
17
+ )
18
+ end
19
+ def self.new(request_options: {})
20
+ end
21
+
22
+ sig { override.returns({ request_options: WhopSDK::RequestOptions }) }
23
+ def to_hash
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,32 @@
1
+ # typed: strong
2
+
3
+ module WhopSDK
4
+ module Models
5
+ # The possible statuses of a dispute
6
+ module DisputeStatuses
7
+ extend WhopSDK::Internal::Type::Enum
8
+
9
+ TaggedSymbol = T.type_alias { T.all(Symbol, WhopSDK::DisputeStatuses) }
10
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
11
+
12
+ WARNING_NEEDS_RESPONSE =
13
+ T.let(:warning_needs_response, WhopSDK::DisputeStatuses::TaggedSymbol)
14
+ WARNING_UNDER_REVIEW =
15
+ T.let(:warning_under_review, WhopSDK::DisputeStatuses::TaggedSymbol)
16
+ WARNING_CLOSED =
17
+ T.let(:warning_closed, WhopSDK::DisputeStatuses::TaggedSymbol)
18
+ NEEDS_RESPONSE =
19
+ T.let(:needs_response, WhopSDK::DisputeStatuses::TaggedSymbol)
20
+ UNDER_REVIEW =
21
+ T.let(:under_review, WhopSDK::DisputeStatuses::TaggedSymbol)
22
+ WON = T.let(:won, WhopSDK::DisputeStatuses::TaggedSymbol)
23
+ LOST = T.let(:lost, WhopSDK::DisputeStatuses::TaggedSymbol)
24
+ CLOSED = T.let(:closed, WhopSDK::DisputeStatuses::TaggedSymbol)
25
+ OTHER = T.let(:other, WhopSDK::DisputeStatuses::TaggedSymbol)
26
+
27
+ sig { override.returns(T::Array[WhopSDK::DisputeStatuses::TaggedSymbol]) }
28
+ def self.values
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,30 @@
1
+ # typed: strong
2
+
3
+ module WhopSDK
4
+ module Models
5
+ class DisputeSubmitEvidenceParams < WhopSDK::Internal::Type::BaseModel
6
+ extend WhopSDK::Internal::Type::RequestParameters::Converter
7
+ include WhopSDK::Internal::Type::RequestParameters
8
+
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(
12
+ WhopSDK::DisputeSubmitEvidenceParams,
13
+ WhopSDK::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ sig do
18
+ params(request_options: WhopSDK::RequestOptions::OrHash).returns(
19
+ T.attached_class
20
+ )
21
+ end
22
+ def self.new(request_options: {})
23
+ end
24
+
25
+ sig { override.returns({ request_options: WhopSDK::RequestOptions }) }
26
+ def to_hash
27
+ end
28
+ end
29
+ end
30
+ end