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,113 @@
1
+ # typed: strong
2
+
3
+ module WhopSDK
4
+ module Models
5
+ class NotificationCreateParams < 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::NotificationCreateParams, WhopSDK::Internal::AnyHash)
12
+ end
13
+
14
+ # The id of the company to target. Only team members of this company will receive
15
+ # the notification. When clicked will take the user to your dashboard app view.
16
+ sig { returns(String) }
17
+ attr_accessor :company_id
18
+
19
+ # The content of the notification
20
+ sig { returns(String) }
21
+ attr_accessor :content
22
+
23
+ # The title of the notification
24
+ sig { returns(String) }
25
+ attr_accessor :title
26
+
27
+ # Optional: ID of a Whop user whose profile picture will be used as the
28
+ # notification icon. If not provided, defaults to the experience or company
29
+ # avatar.
30
+ sig { returns(T.nilable(String)) }
31
+ attr_accessor :icon_user_id
32
+
33
+ # The rest path to append to the generated deep link that opens your app. Use
34
+ # [restPath] in your app path in the dashboard to read this parameter.
35
+ sig { returns(T.nilable(String)) }
36
+ attr_accessor :rest_path
37
+
38
+ # The subtitle of the notification
39
+ sig { returns(T.nilable(String)) }
40
+ attr_accessor :subtitle
41
+
42
+ # If provided, this will only send to these users if they are also in the main
43
+ # scope (experience or company)
44
+ sig { returns(T.nilable(T::Array[String])) }
45
+ attr_accessor :user_ids
46
+
47
+ # The id of the experience to target. All users with access to this experience
48
+ # (customers and admins) will receive the notification. When clicked, open your
49
+ # experience view.
50
+ sig { returns(String) }
51
+ attr_accessor :experience_id
52
+
53
+ sig do
54
+ params(
55
+ company_id: String,
56
+ content: String,
57
+ title: String,
58
+ experience_id: String,
59
+ icon_user_id: T.nilable(String),
60
+ rest_path: T.nilable(String),
61
+ subtitle: T.nilable(String),
62
+ user_ids: T.nilable(T::Array[String]),
63
+ request_options: WhopSDK::RequestOptions::OrHash
64
+ ).returns(T.attached_class)
65
+ end
66
+ def self.new(
67
+ # The id of the company to target. Only team members of this company will receive
68
+ # the notification. When clicked will take the user to your dashboard app view.
69
+ company_id:,
70
+ # The content of the notification
71
+ content:,
72
+ # The title of the notification
73
+ title:,
74
+ # The id of the experience to target. All users with access to this experience
75
+ # (customers and admins) will receive the notification. When clicked, open your
76
+ # experience view.
77
+ experience_id:,
78
+ # Optional: ID of a Whop user whose profile picture will be used as the
79
+ # notification icon. If not provided, defaults to the experience or company
80
+ # avatar.
81
+ icon_user_id: nil,
82
+ # The rest path to append to the generated deep link that opens your app. Use
83
+ # [restPath] in your app path in the dashboard to read this parameter.
84
+ rest_path: nil,
85
+ # The subtitle of the notification
86
+ subtitle: nil,
87
+ # If provided, this will only send to these users if they are also in the main
88
+ # scope (experience or company)
89
+ user_ids: nil,
90
+ request_options: {}
91
+ )
92
+ end
93
+
94
+ sig do
95
+ override.returns(
96
+ {
97
+ company_id: String,
98
+ content: String,
99
+ title: String,
100
+ icon_user_id: T.nilable(String),
101
+ rest_path: T.nilable(String),
102
+ subtitle: T.nilable(String),
103
+ user_ids: T.nilable(T::Array[String]),
104
+ experience_id: String,
105
+ request_options: WhopSDK::RequestOptions
106
+ }
107
+ )
108
+ end
109
+ def to_hash
110
+ end
111
+ end
112
+ end
113
+ end
@@ -0,0 +1,31 @@
1
+ # typed: strong
2
+
3
+ module WhopSDK
4
+ module Models
5
+ class NotificationCreateResponse < WhopSDK::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ WhopSDK::Models::NotificationCreateResponse,
10
+ WhopSDK::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ # Whether the notification was successfully queued for delivery
15
+ sig { returns(T::Boolean) }
16
+ attr_accessor :success
17
+
18
+ # Response from queuing a notification
19
+ sig { params(success: T::Boolean).returns(T.attached_class) }
20
+ def self.new(
21
+ # Whether the notification was successfully queued for delivery
22
+ success:
23
+ )
24
+ end
25
+
26
+ sig { override.returns({ success: T::Boolean }) }
27
+ def to_hash
28
+ end
29
+ end
30
+ end
31
+ end
@@ -21,7 +21,9 @@ module WhopSDK
21
21
  WhopSDK::CourseLessonInteractionCompletedWebhookEvent,
22
22
  WhopSDK::PaymentSucceededWebhookEvent,
23
23
  WhopSDK::PaymentFailedWebhookEvent,
24
- WhopSDK::PaymentPendingWebhookEvent
24
+ WhopSDK::PaymentPendingWebhookEvent,
25
+ WhopSDK::DisputeCreatedWebhookEvent,
26
+ WhopSDK::DisputeUpdatedWebhookEvent
25
27
  )
26
28
  end
27
29
 
@@ -138,6 +138,22 @@ module WhopSDK
138
138
 
139
139
  Direction = WhopSDK::Models::Direction
140
140
 
141
+ Dispute = WhopSDK::Models::Dispute
142
+
143
+ DisputeCreatedWebhookEvent = WhopSDK::Models::DisputeCreatedWebhookEvent
144
+
145
+ DisputeListParams = WhopSDK::Models::DisputeListParams
146
+
147
+ DisputeRetrieveParams = WhopSDK::Models::DisputeRetrieveParams
148
+
149
+ DisputeStatuses = WhopSDK::Models::DisputeStatuses
150
+
151
+ DisputeSubmitEvidenceParams = WhopSDK::Models::DisputeSubmitEvidenceParams
152
+
153
+ DisputeUpdatedWebhookEvent = WhopSDK::Models::DisputeUpdatedWebhookEvent
154
+
155
+ DisputeUpdateEvidenceParams = WhopSDK::Models::DisputeUpdateEvidenceParams
156
+
141
157
  DmsPostTypes = WhopSDK::Models::DmsPostTypes
142
158
 
143
159
  EmailNotificationPreferences = WhopSDK::Models::EmailNotificationPreferences
@@ -278,6 +294,8 @@ module WhopSDK
278
294
 
279
295
  MessageUpdateParams = WhopSDK::Models::MessageUpdateParams
280
296
 
297
+ NotificationCreateParams = WhopSDK::Models::NotificationCreateParams
298
+
281
299
  PageInfo = WhopSDK::Models::PageInfo
282
300
 
283
301
  Payment = WhopSDK::Models::Payment
@@ -0,0 +1,194 @@
1
+ # typed: strong
2
+
3
+ module WhopSDK
4
+ module Resources
5
+ class Disputes
6
+ # Retrieves a Dispute by ID
7
+ #
8
+ # Required permissions:
9
+ #
10
+ # - `payment:dispute:read`
11
+ # - `plan:basic:read`
12
+ # - `access_pass:basic:read`
13
+ # - `company:basic:read`
14
+ # - `payment:basic:read`
15
+ # - `member:email:read`
16
+ # - `member:basic:read`
17
+ # - `member:phone:read`
18
+ sig do
19
+ params(
20
+ id: String,
21
+ request_options: WhopSDK::RequestOptions::OrHash
22
+ ).returns(WhopSDK::Dispute)
23
+ end
24
+ def retrieve(
25
+ # The ID of the dispute
26
+ id,
27
+ request_options: {}
28
+ )
29
+ end
30
+
31
+ # Lists disputes the current actor has access to
32
+ #
33
+ # Required permissions:
34
+ #
35
+ # - `payment:dispute:read`
36
+ # - `plan:basic:read`
37
+ # - `access_pass:basic:read`
38
+ # - `company:basic:read`
39
+ # - `payment:basic:read`
40
+ sig do
41
+ params(
42
+ company_id: String,
43
+ after: T.nilable(String),
44
+ before: T.nilable(String),
45
+ direction: T.nilable(WhopSDK::Direction::OrSymbol),
46
+ first: T.nilable(Integer),
47
+ last: T.nilable(Integer),
48
+ request_options: WhopSDK::RequestOptions::OrHash
49
+ ).returns(
50
+ WhopSDK::Internal::CursorPage[WhopSDK::Models::DisputeListResponse]
51
+ )
52
+ end
53
+ def list(
54
+ # The ID of the company to list disputes for
55
+ company_id:,
56
+ # Returns the elements in the list that come after the specified cursor.
57
+ after: nil,
58
+ # Returns the elements in the list that come before the specified cursor.
59
+ before: nil,
60
+ # The direction of the sort.
61
+ direction: nil,
62
+ # Returns the first _n_ elements from the list.
63
+ first: nil,
64
+ # Returns the last _n_ elements from the list.
65
+ last: nil,
66
+ request_options: {}
67
+ )
68
+ end
69
+
70
+ # Submit a payment dispute to the payment processor for review. Once submitted, no
71
+ # further edits can be made.
72
+ #
73
+ # Required permissions:
74
+ #
75
+ # - `payment:dispute`
76
+ # - `plan:basic:read`
77
+ # - `access_pass:basic:read`
78
+ # - `company:basic:read`
79
+ # - `payment:basic:read`
80
+ # - `member:email:read`
81
+ # - `member:basic:read`
82
+ # - `member:phone:read`
83
+ sig do
84
+ params(
85
+ id: String,
86
+ request_options: WhopSDK::RequestOptions::OrHash
87
+ ).returns(WhopSDK::Dispute)
88
+ end
89
+ def submit_evidence(
90
+ # The ID of the dispute (Ex. dspt_xxxx) you want to finalize evidence submission
91
+ # for and send to the processor.
92
+ id,
93
+ request_options: {}
94
+ )
95
+ end
96
+
97
+ # Update a dispute with evidence data to attempt to win the dispute.
98
+ #
99
+ # Required permissions:
100
+ #
101
+ # - `payment:dispute`
102
+ # - `plan:basic:read`
103
+ # - `access_pass:basic:read`
104
+ # - `company:basic:read`
105
+ # - `payment:basic:read`
106
+ # - `member:email:read`
107
+ # - `member:basic:read`
108
+ # - `member:phone:read`
109
+ sig do
110
+ params(
111
+ id: String,
112
+ access_activity_log: T.nilable(String),
113
+ billing_address: T.nilable(String),
114
+ cancellation_policy_attachment:
115
+ T.nilable(
116
+ T.any(
117
+ WhopSDK::DisputeUpdateEvidenceParams::CancellationPolicyAttachment::AttachmentInputWithDirectUploadID::OrHash,
118
+ WhopSDK::DisputeUpdateEvidenceParams::CancellationPolicyAttachment::AttachmentInputWithID::OrHash
119
+ )
120
+ ),
121
+ cancellation_policy_disclosure: T.nilable(String),
122
+ customer_communication_attachment:
123
+ T.nilable(
124
+ T.any(
125
+ WhopSDK::DisputeUpdateEvidenceParams::CustomerCommunicationAttachment::AttachmentInputWithDirectUploadID::OrHash,
126
+ WhopSDK::DisputeUpdateEvidenceParams::CustomerCommunicationAttachment::AttachmentInputWithID::OrHash
127
+ )
128
+ ),
129
+ customer_email_address: T.nilable(String),
130
+ customer_name: T.nilable(String),
131
+ notes: T.nilable(String),
132
+ product_description: T.nilable(String),
133
+ refund_policy_attachment:
134
+ T.nilable(
135
+ T.any(
136
+ WhopSDK::DisputeUpdateEvidenceParams::RefundPolicyAttachment::AttachmentInputWithDirectUploadID::OrHash,
137
+ WhopSDK::DisputeUpdateEvidenceParams::RefundPolicyAttachment::AttachmentInputWithID::OrHash
138
+ )
139
+ ),
140
+ refund_policy_disclosure: T.nilable(String),
141
+ refund_refusal_explanation: T.nilable(String),
142
+ service_date: T.nilable(String),
143
+ uncategorized_attachment:
144
+ T.nilable(
145
+ T.any(
146
+ WhopSDK::DisputeUpdateEvidenceParams::UncategorizedAttachment::AttachmentInputWithDirectUploadID::OrHash,
147
+ WhopSDK::DisputeUpdateEvidenceParams::UncategorizedAttachment::AttachmentInputWithID::OrHash
148
+ )
149
+ ),
150
+ request_options: WhopSDK::RequestOptions::OrHash
151
+ ).returns(WhopSDK::Dispute)
152
+ end
153
+ def update_evidence(
154
+ # The ID of the dispute you want to update.
155
+ id,
156
+ # An IP access log for the user from Whop.
157
+ access_activity_log: nil,
158
+ # The billing address of the user from their payment details.
159
+ billing_address: nil,
160
+ # A file containing the cancellation policy from the company.
161
+ cancellation_policy_attachment: nil,
162
+ # A cancellation policy disclosure from the company.
163
+ cancellation_policy_disclosure: nil,
164
+ # A file containing the customer communication from the company (An image).
165
+ customer_communication_attachment: nil,
166
+ # The email of the customer from their payment details.
167
+ customer_email_address: nil,
168
+ # The name of the customer from their payment details.
169
+ customer_name: nil,
170
+ # Additional notes the company chooses to submit regarding the dispute.
171
+ notes: nil,
172
+ # The description of the product from the company.
173
+ product_description: nil,
174
+ # A file containing the refund policy from the company.
175
+ refund_policy_attachment: nil,
176
+ # A refund policy disclosure from the company.
177
+ refund_policy_disclosure: nil,
178
+ # A description on why the refund is being refused by the company.
179
+ refund_refusal_explanation: nil,
180
+ # When the product was delivered by the company.
181
+ service_date: nil,
182
+ # A file that does not fit in the other categories.
183
+ uncategorized_attachment: nil,
184
+ request_options: {}
185
+ )
186
+ end
187
+
188
+ # @api private
189
+ sig { params(client: WhopSDK::Client).returns(T.attached_class) }
190
+ def self.new(client:)
191
+ end
192
+ end
193
+ end
194
+ end
@@ -0,0 +1,54 @@
1
+ # typed: strong
2
+
3
+ module WhopSDK
4
+ module Resources
5
+ class Notifications
6
+ # Queues a notification to be sent to users in an experience or company team
7
+ sig do
8
+ params(
9
+ company_id: String,
10
+ content: String,
11
+ title: String,
12
+ experience_id: String,
13
+ icon_user_id: T.nilable(String),
14
+ rest_path: T.nilable(String),
15
+ subtitle: T.nilable(String),
16
+ user_ids: T.nilable(T::Array[String]),
17
+ request_options: WhopSDK::RequestOptions::OrHash
18
+ ).returns(WhopSDK::Models::NotificationCreateResponse)
19
+ end
20
+ def create(
21
+ # The id of the company to target. Only team members of this company will receive
22
+ # the notification. When clicked will take the user to your dashboard app view.
23
+ company_id:,
24
+ # The content of the notification
25
+ content:,
26
+ # The title of the notification
27
+ title:,
28
+ # The id of the experience to target. All users with access to this experience
29
+ # (customers and admins) will receive the notification. When clicked, open your
30
+ # experience view.
31
+ experience_id:,
32
+ # Optional: ID of a Whop user whose profile picture will be used as the
33
+ # notification icon. If not provided, defaults to the experience or company
34
+ # avatar.
35
+ icon_user_id: nil,
36
+ # The rest path to append to the generated deep link that opens your app. Use
37
+ # [restPath] in your app path in the dashboard to read this parameter.
38
+ rest_path: nil,
39
+ # The subtitle of the notification
40
+ subtitle: nil,
41
+ # If provided, this will only send to these users if they are also in the main
42
+ # scope (experience or company)
43
+ user_ids: nil,
44
+ request_options: {}
45
+ )
46
+ end
47
+
48
+ # @api private
49
+ sig { params(client: WhopSDK::Client).returns(T.attached_class) }
50
+ def self.new(client:)
51
+ end
52
+ end
53
+ end
54
+ end
@@ -19,7 +19,9 @@ module WhopSDK
19
19
  WhopSDK::CourseLessonInteractionCompletedWebhookEvent,
20
20
  WhopSDK::PaymentSucceededWebhookEvent,
21
21
  WhopSDK::PaymentFailedWebhookEvent,
22
- WhopSDK::PaymentPendingWebhookEvent
22
+ WhopSDK::PaymentPendingWebhookEvent,
23
+ WhopSDK::DisputeCreatedWebhookEvent,
24
+ WhopSDK::DisputeUpdatedWebhookEvent
23
25
  )
24
26
  )
25
27
  end
@@ -10,7 +10,7 @@ module WhopSDK
10
10
 
11
11
  attr_reader api_key: String
12
12
 
13
- attr_reader app_id: String
13
+ attr_reader app_id: String?
14
14
 
15
15
  attr_reader apps: WhopSDK::Resources::Apps
16
16
 
@@ -76,6 +76,10 @@ module WhopSDK
76
76
 
77
77
  attr_reader access_tokens: WhopSDK::Resources::AccessTokens
78
78
 
79
+ attr_reader notifications: WhopSDK::Resources::Notifications
80
+
81
+ attr_reader disputes: WhopSDK::Resources::Disputes
82
+
79
83
  private def auth_headers: -> ::Hash[String, String]
80
84
 
81
85
  def initialize: (
@@ -145,6 +145,7 @@ module WhopSDK
145
145
  | :linkedin
146
146
  | :twitch
147
147
  | :website
148
+ | :custom
148
149
 
149
150
  module Website
150
151
  extend WhopSDK::Internal::Type::Enum
@@ -157,6 +158,7 @@ module WhopSDK
157
158
  LINKEDIN: :linkedin
158
159
  TWITCH: :twitch
159
160
  WEBSITE: :website
161
+ CUSTOM: :custom
160
162
 
161
163
  def self?.values: -> ::Array[WhopSDK::Models::Company::SocialLink::website]
162
164
  end