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,182 @@
1
+ # frozen_string_literal: true
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
+ #
19
+ # @overload retrieve(id, request_options: {})
20
+ #
21
+ # @param id [String] The ID of the dispute
22
+ #
23
+ # @param request_options [WhopSDK::RequestOptions, Hash{Symbol=>Object}, nil]
24
+ #
25
+ # @return [WhopSDK::Models::Dispute]
26
+ #
27
+ # @see WhopSDK::Models::DisputeRetrieveParams
28
+ def retrieve(id, params = {})
29
+ @client.request(
30
+ method: :get,
31
+ path: ["disputes/%1$s", id],
32
+ model: WhopSDK::Dispute,
33
+ options: params[:request_options]
34
+ )
35
+ end
36
+
37
+ # Lists disputes the current actor has access to
38
+ #
39
+ # Required permissions:
40
+ #
41
+ # - `payment:dispute:read`
42
+ # - `plan:basic:read`
43
+ # - `access_pass:basic:read`
44
+ # - `company:basic:read`
45
+ # - `payment:basic:read`
46
+ #
47
+ # @overload list(company_id:, after: nil, before: nil, direction: nil, first: nil, last: nil, request_options: {})
48
+ #
49
+ # @param company_id [String] The ID of the company to list disputes for
50
+ #
51
+ # @param after [String, nil] Returns the elements in the list that come after the specified cursor.
52
+ #
53
+ # @param before [String, nil] Returns the elements in the list that come before the specified cursor.
54
+ #
55
+ # @param direction [Symbol, WhopSDK::Models::Direction, nil] The direction of the sort.
56
+ #
57
+ # @param first [Integer, nil] Returns the first _n_ elements from the list.
58
+ #
59
+ # @param last [Integer, nil] Returns the last _n_ elements from the list.
60
+ #
61
+ # @param request_options [WhopSDK::RequestOptions, Hash{Symbol=>Object}, nil]
62
+ #
63
+ # @return [WhopSDK::Internal::CursorPage<WhopSDK::Models::DisputeListResponse>]
64
+ #
65
+ # @see WhopSDK::Models::DisputeListParams
66
+ def list(params)
67
+ parsed, options = WhopSDK::DisputeListParams.dump_request(params)
68
+ @client.request(
69
+ method: :get,
70
+ path: "disputes",
71
+ query: parsed,
72
+ page: WhopSDK::Internal::CursorPage,
73
+ model: WhopSDK::Models::DisputeListResponse,
74
+ options: options
75
+ )
76
+ end
77
+
78
+ # Some parameter documentations has been truncated, see
79
+ # {WhopSDK::Models::DisputeSubmitEvidenceParams} for more details.
80
+ #
81
+ # Submit a payment dispute to the payment processor for review. Once submitted, no
82
+ # further edits can be made.
83
+ #
84
+ # Required permissions:
85
+ #
86
+ # - `payment:dispute`
87
+ # - `plan:basic:read`
88
+ # - `access_pass:basic:read`
89
+ # - `company:basic:read`
90
+ # - `payment:basic:read`
91
+ # - `member:email:read`
92
+ # - `member:basic:read`
93
+ # - `member:phone:read`
94
+ #
95
+ # @overload submit_evidence(id, request_options: {})
96
+ #
97
+ # @param id [String] The ID of the dispute (Ex. dspt_xxxx) you want to finalize evidence submission f
98
+ #
99
+ # @param request_options [WhopSDK::RequestOptions, Hash{Symbol=>Object}, nil]
100
+ #
101
+ # @return [WhopSDK::Models::Dispute]
102
+ #
103
+ # @see WhopSDK::Models::DisputeSubmitEvidenceParams
104
+ def submit_evidence(id, params = {})
105
+ @client.request(
106
+ method: :post,
107
+ path: ["disputes/%1$s/submit_evidence", id],
108
+ model: WhopSDK::Dispute,
109
+ options: params[:request_options]
110
+ )
111
+ end
112
+
113
+ # Update a dispute with evidence data to attempt to win the dispute.
114
+ #
115
+ # Required permissions:
116
+ #
117
+ # - `payment:dispute`
118
+ # - `plan:basic:read`
119
+ # - `access_pass:basic:read`
120
+ # - `company:basic:read`
121
+ # - `payment:basic:read`
122
+ # - `member:email:read`
123
+ # - `member:basic:read`
124
+ # - `member:phone:read`
125
+ #
126
+ # @overload update_evidence(id, access_activity_log: nil, billing_address: nil, cancellation_policy_attachment: nil, cancellation_policy_disclosure: nil, customer_communication_attachment: nil, customer_email_address: nil, customer_name: nil, notes: nil, product_description: nil, refund_policy_attachment: nil, refund_policy_disclosure: nil, refund_refusal_explanation: nil, service_date: nil, uncategorized_attachment: nil, request_options: {})
127
+ #
128
+ # @param id [String] The ID of the dispute you want to update.
129
+ #
130
+ # @param access_activity_log [String, nil] An IP access log for the user from Whop.
131
+ #
132
+ # @param billing_address [String, nil] The billing address of the user from their payment details.
133
+ #
134
+ # @param cancellation_policy_attachment [WhopSDK::Models::DisputeUpdateEvidenceParams::CancellationPolicyAttachment::AttachmentInputWithDirectUploadID, WhopSDK::Models::DisputeUpdateEvidenceParams::CancellationPolicyAttachment::AttachmentInputWithID, nil] A file containing the cancellation policy from the company.
135
+ #
136
+ # @param cancellation_policy_disclosure [String, nil] A cancellation policy disclosure from the company.
137
+ #
138
+ # @param customer_communication_attachment [WhopSDK::Models::DisputeUpdateEvidenceParams::CustomerCommunicationAttachment::AttachmentInputWithDirectUploadID, WhopSDK::Models::DisputeUpdateEvidenceParams::CustomerCommunicationAttachment::AttachmentInputWithID, nil] A file containing the customer communication from the company (An image).
139
+ #
140
+ # @param customer_email_address [String, nil] The email of the customer from their payment details.
141
+ #
142
+ # @param customer_name [String, nil] The name of the customer from their payment details.
143
+ #
144
+ # @param notes [String, nil] Additional notes the company chooses to submit regarding the dispute.
145
+ #
146
+ # @param product_description [String, nil] The description of the product from the company.
147
+ #
148
+ # @param refund_policy_attachment [WhopSDK::Models::DisputeUpdateEvidenceParams::RefundPolicyAttachment::AttachmentInputWithDirectUploadID, WhopSDK::Models::DisputeUpdateEvidenceParams::RefundPolicyAttachment::AttachmentInputWithID, nil] A file containing the refund policy from the company.
149
+ #
150
+ # @param refund_policy_disclosure [String, nil] A refund policy disclosure from the company.
151
+ #
152
+ # @param refund_refusal_explanation [String, nil] A description on why the refund is being refused by the company.
153
+ #
154
+ # @param service_date [String, nil] When the product was delivered by the company.
155
+ #
156
+ # @param uncategorized_attachment [WhopSDK::Models::DisputeUpdateEvidenceParams::UncategorizedAttachment::AttachmentInputWithDirectUploadID, WhopSDK::Models::DisputeUpdateEvidenceParams::UncategorizedAttachment::AttachmentInputWithID, nil] A file that does not fit in the other categories.
157
+ #
158
+ # @param request_options [WhopSDK::RequestOptions, Hash{Symbol=>Object}, nil]
159
+ #
160
+ # @return [WhopSDK::Models::Dispute]
161
+ #
162
+ # @see WhopSDK::Models::DisputeUpdateEvidenceParams
163
+ def update_evidence(id, params = {})
164
+ parsed, options = WhopSDK::DisputeUpdateEvidenceParams.dump_request(params)
165
+ @client.request(
166
+ method: :post,
167
+ path: ["disputes/%1$s/update_evidence", id],
168
+ body: parsed,
169
+ model: WhopSDK::Dispute,
170
+ options: options
171
+ )
172
+ end
173
+
174
+ # @api private
175
+ #
176
+ # @param client [WhopSDK::Client]
177
+ def initialize(client:)
178
+ @client = client
179
+ end
180
+ end
181
+ end
182
+ end
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WhopSDK
4
+ module Resources
5
+ class Notifications
6
+ # Some parameter documentations has been truncated, see
7
+ # {WhopSDK::Models::NotificationCreateParams} for more details.
8
+ #
9
+ # Queues a notification to be sent to users in an experience or company team
10
+ #
11
+ # @overload create(company_id:, content:, title:, experience_id:, icon_user_id: nil, rest_path: nil, subtitle: nil, user_ids: nil, request_options: {})
12
+ #
13
+ # @param company_id [String] The id of the company to target. Only team members of this company will receive
14
+ #
15
+ # @param content [String] The content of the notification
16
+ #
17
+ # @param title [String] The title of the notification
18
+ #
19
+ # @param experience_id [String] The id of the experience to target. All users with access to this experience (cu
20
+ #
21
+ # @param icon_user_id [String, nil] Optional: ID of a Whop user whose profile picture will be used as the notificati
22
+ #
23
+ # @param rest_path [String, nil] The rest path to append to the generated deep link that opens your app. Use [res
24
+ #
25
+ # @param subtitle [String, nil] The subtitle of the notification
26
+ #
27
+ # @param user_ids [Array<String>, nil] If provided, this will only send to these users if they are also in the main sco
28
+ #
29
+ # @param request_options [WhopSDK::RequestOptions, Hash{Symbol=>Object}, nil]
30
+ #
31
+ # @return [WhopSDK::Models::NotificationCreateResponse]
32
+ #
33
+ # @see WhopSDK::Models::NotificationCreateParams
34
+ def create(params)
35
+ parsed, options = WhopSDK::NotificationCreateParams.dump_request(params)
36
+ @client.request(
37
+ method: :post,
38
+ path: "notifications",
39
+ body: parsed,
40
+ model: WhopSDK::Models::NotificationCreateResponse,
41
+ options: options
42
+ )
43
+ end
44
+
45
+ # @api private
46
+ #
47
+ # @param client [WhopSDK::Client]
48
+ def initialize(client:)
49
+ @client = client
50
+ end
51
+ end
52
+ end
53
+ end
@@ -5,7 +5,7 @@ module WhopSDK
5
5
  class Webhooks
6
6
  # @param payload [String] The raw webhook payload as a string
7
7
  #
8
- # @return [WhopSDK::Models::InvoiceCreatedWebhookEvent, WhopSDK::Models::InvoicePaidWebhookEvent, WhopSDK::Models::InvoicePastDueWebhookEvent, WhopSDK::Models::InvoiceVoidedWebhookEvent, WhopSDK::Models::MembershipActivatedWebhookEvent, WhopSDK::Models::MembershipDeactivatedWebhookEvent, WhopSDK::Models::EntryCreatedWebhookEvent, WhopSDK::Models::EntryApprovedWebhookEvent, WhopSDK::Models::EntryDeniedWebhookEvent, WhopSDK::Models::EntryDeletedWebhookEvent, WhopSDK::Models::CourseLessonInteractionCompletedWebhookEvent, WhopSDK::Models::PaymentSucceededWebhookEvent, WhopSDK::Models::PaymentFailedWebhookEvent, WhopSDK::Models::PaymentPendingWebhookEvent]
8
+ # @return [WhopSDK::Models::InvoiceCreatedWebhookEvent, WhopSDK::Models::InvoicePaidWebhookEvent, WhopSDK::Models::InvoicePastDueWebhookEvent, WhopSDK::Models::InvoiceVoidedWebhookEvent, WhopSDK::Models::MembershipActivatedWebhookEvent, WhopSDK::Models::MembershipDeactivatedWebhookEvent, WhopSDK::Models::EntryCreatedWebhookEvent, WhopSDK::Models::EntryApprovedWebhookEvent, WhopSDK::Models::EntryDeniedWebhookEvent, WhopSDK::Models::EntryDeletedWebhookEvent, WhopSDK::Models::CourseLessonInteractionCompletedWebhookEvent, WhopSDK::Models::PaymentSucceededWebhookEvent, WhopSDK::Models::PaymentFailedWebhookEvent, WhopSDK::Models::PaymentPendingWebhookEvent, WhopSDK::Models::DisputeCreatedWebhookEvent, WhopSDK::Models::DisputeUpdatedWebhookEvent]
9
9
  def unwrap(payload)
10
10
  parsed = JSON.parse(payload, symbolize_names: true)
11
11
  WhopSDK::Internal::Type::Converter.coerce(WhopSDK::Models::UnwrapWebhookEvent, parsed)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WhopSDK
4
- VERSION = "0.0.5"
4
+ VERSION = "0.0.6"
5
5
  end
data/lib/whop_sdk.rb CHANGED
@@ -133,6 +133,15 @@ require_relative "whop_sdk/models/course_visibilities"
133
133
  require_relative "whop_sdk/models/currency"
134
134
  require_relative "whop_sdk/models/custom_cta"
135
135
  require_relative "whop_sdk/models/direction"
136
+ require_relative "whop_sdk/models/dispute"
137
+ require_relative "whop_sdk/models/dispute_created_webhook_event"
138
+ require_relative "whop_sdk/models/dispute_list_params"
139
+ require_relative "whop_sdk/models/dispute_list_response"
140
+ require_relative "whop_sdk/models/dispute_retrieve_params"
141
+ require_relative "whop_sdk/models/dispute_statuses"
142
+ require_relative "whop_sdk/models/dispute_submit_evidence_params"
143
+ require_relative "whop_sdk/models/dispute_updated_webhook_event"
144
+ require_relative "whop_sdk/models/dispute_update_evidence_params"
136
145
  require_relative "whop_sdk/models/dms_post_types"
137
146
  require_relative "whop_sdk/models/email_notification_preferences"
138
147
  require_relative "whop_sdk/models/embed_type"
@@ -214,6 +223,8 @@ require_relative "whop_sdk/models/message_list_params"
214
223
  require_relative "whop_sdk/models/message_list_response"
215
224
  require_relative "whop_sdk/models/message_retrieve_params"
216
225
  require_relative "whop_sdk/models/message_update_params"
226
+ require_relative "whop_sdk/models/notification_create_params"
227
+ require_relative "whop_sdk/models/notification_create_response"
217
228
  require_relative "whop_sdk/models/page_info"
218
229
  require_relative "whop_sdk/models/payment"
219
230
  require_relative "whop_sdk/models/payment_failed_webhook_event"
@@ -309,6 +320,7 @@ require_relative "whop_sdk/resources/course_lesson_interactions"
309
320
  require_relative "whop_sdk/resources/course_lessons"
310
321
  require_relative "whop_sdk/resources/courses"
311
322
  require_relative "whop_sdk/resources/course_students"
323
+ require_relative "whop_sdk/resources/disputes"
312
324
  require_relative "whop_sdk/resources/entries"
313
325
  require_relative "whop_sdk/resources/experiences"
314
326
  require_relative "whop_sdk/resources/forum_posts"
@@ -318,6 +330,7 @@ require_relative "whop_sdk/resources/ledger_accounts"
318
330
  require_relative "whop_sdk/resources/members"
319
331
  require_relative "whop_sdk/resources/memberships"
320
332
  require_relative "whop_sdk/resources/messages"
333
+ require_relative "whop_sdk/resources/notifications"
321
334
  require_relative "whop_sdk/resources/payments"
322
335
  require_relative "whop_sdk/resources/plans"
323
336
  require_relative "whop_sdk/resources/products"
@@ -14,7 +14,9 @@ module WhopSDK
14
14
  sig { returns(String) }
15
15
  attr_reader :api_key
16
16
 
17
- sig { returns(String) }
17
+ # When using the SDK in app mode pass this parameter to allow verifying user
18
+ # tokens
19
+ sig { returns(T.nilable(String)) }
18
20
  attr_reader :app_id
19
21
 
20
22
  sig { returns(WhopSDK::Resources::Apps) }
@@ -113,6 +115,12 @@ module WhopSDK
113
115
  sig { returns(WhopSDK::Resources::AccessTokens) }
114
116
  attr_reader :access_tokens
115
117
 
118
+ sig { returns(WhopSDK::Resources::Notifications) }
119
+ attr_reader :notifications
120
+
121
+ sig { returns(WhopSDK::Resources::Disputes) }
122
+ attr_reader :disputes
123
+
116
124
  # @api private
117
125
  sig { override.returns(T::Hash[String, String]) }
118
126
  private def auth_headers
@@ -134,7 +142,8 @@ module WhopSDK
134
142
  # The app API key from an app from the /dashboard/developer page Defaults to
135
143
  # `ENV["WHOP_API_KEY"]`
136
144
  api_key: ENV["WHOP_API_KEY"],
137
- # Defaults to `ENV["WHOP_APP_ID"]`
145
+ # When using the SDK in app mode pass this parameter to allow verifying user
146
+ # tokens Defaults to `ENV["WHOP_APP_ID"]`
138
147
  app_id: ENV["WHOP_APP_ID"],
139
148
  # Override the default base URL for the API, e.g.,
140
149
  # `"https://api.example.com/v2/"`. Defaults to `ENV["WHOP_BASE_URL"]`
@@ -302,6 +302,8 @@ module WhopSDK
302
302
  T.let(:twitch, WhopSDK::Company::SocialLink::Website::TaggedSymbol)
303
303
  WEBSITE =
304
304
  T.let(:website, WhopSDK::Company::SocialLink::Website::TaggedSymbol)
305
+ CUSTOM =
306
+ T.let(:custom, WhopSDK::Company::SocialLink::Website::TaggedSymbol)
305
307
 
306
308
  sig do
307
309
  override.returns(