whop_sdk 0.0.5 → 0.0.7
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +28 -0
- data/README.md +4 -7
- data/lib/whop_sdk/client.rb +17 -6
- data/lib/whop_sdk/models/access_token_create_params.rb +26 -36
- data/lib/whop_sdk/models/card_brands.rb +1 -0
- data/lib/whop_sdk/models/checkout_configuration_create_params.rb +9 -9
- data/lib/whop_sdk/models/company.rb +1 -0
- data/lib/whop_sdk/models/currency.rb +1 -0
- data/lib/whop_sdk/models/dispute.rb +672 -0
- data/lib/whop_sdk/models/dispute_created_webhook_event.rb +48 -0
- data/lib/whop_sdk/models/dispute_list_params.rb +62 -0
- data/lib/whop_sdk/models/dispute_list_response.rb +187 -0
- data/lib/whop_sdk/models/dispute_retrieve_params.rb +14 -0
- data/lib/whop_sdk/models/dispute_statuses.rb +23 -0
- data/lib/whop_sdk/models/dispute_submit_evidence_params.rb +14 -0
- data/lib/whop_sdk/models/dispute_update_evidence_params.rb +342 -0
- data/lib/whop_sdk/models/dispute_updated_webhook_event.rb +48 -0
- data/lib/whop_sdk/models/forum_post_create_params.rb +20 -1
- data/lib/whop_sdk/models/forum_post_update_params.rb +20 -1
- data/lib/whop_sdk/models/ledger_account_retrieve_response.rb +1 -0
- data/lib/whop_sdk/models/notification_create_params.rb +88 -0
- data/lib/whop_sdk/models/notification_create_response.rb +19 -0
- data/lib/whop_sdk/models/shipment.rb +3 -3
- data/lib/whop_sdk/models/shipment_list_response.rb +3 -3
- data/lib/whop_sdk/models/unwrap_webhook_event.rb +5 -1
- data/lib/whop_sdk/models.rb +18 -0
- data/lib/whop_sdk/resources/access_tokens.rb +9 -7
- data/lib/whop_sdk/resources/disputes.rb +182 -0
- data/lib/whop_sdk/resources/forum_posts.rb +6 -2
- data/lib/whop_sdk/resources/notifications.rb +53 -0
- data/lib/whop_sdk/resources/webhooks.rb +1 -1
- data/lib/whop_sdk/version.rb +1 -1
- data/lib/whop_sdk.rb +13 -0
- data/rbi/whop_sdk/client.rbi +11 -2
- data/rbi/whop_sdk/models/access_token_create_params.rbi +34 -77
- data/rbi/whop_sdk/models/card_brands.rbi +1 -0
- data/rbi/whop_sdk/models/checkout_configuration_create_params.rbi +8 -8
- data/rbi/whop_sdk/models/company.rbi +2 -0
- data/rbi/whop_sdk/models/currency.rbi +1 -0
- data/rbi/whop_sdk/models/dispute.rbi +938 -0
- data/rbi/whop_sdk/models/dispute_created_webhook_event.rbi +72 -0
- data/rbi/whop_sdk/models/dispute_list_params.rbi +83 -0
- data/rbi/whop_sdk/models/dispute_list_response.rbi +287 -0
- data/rbi/whop_sdk/models/dispute_retrieve_params.rbi +27 -0
- data/rbi/whop_sdk/models/dispute_statuses.rbi +32 -0
- data/rbi/whop_sdk/models/dispute_submit_evidence_params.rbi +30 -0
- data/rbi/whop_sdk/models/dispute_update_evidence_params.rbi +566 -0
- data/rbi/whop_sdk/models/dispute_updated_webhook_event.rbi +72 -0
- data/rbi/whop_sdk/models/forum_post_create_params.rbi +42 -0
- data/rbi/whop_sdk/models/forum_post_update_params.rbi +42 -0
- data/rbi/whop_sdk/models/ledger_account_retrieve_response.rbi +5 -0
- data/rbi/whop_sdk/models/notification_create_params.rbi +113 -0
- data/rbi/whop_sdk/models/notification_create_response.rbi +31 -0
- data/rbi/whop_sdk/models/shipment.rbi +6 -4
- data/rbi/whop_sdk/models/shipment_list_response.rbi +6 -4
- data/rbi/whop_sdk/models/unwrap_webhook_event.rbi +3 -1
- data/rbi/whop_sdk/models.rbi +18 -0
- data/rbi/whop_sdk/resources/access_tokens.rbi +19 -14
- data/rbi/whop_sdk/resources/disputes.rbi +194 -0
- data/rbi/whop_sdk/resources/forum_posts.rbi +8 -0
- data/rbi/whop_sdk/resources/notifications.rbi +54 -0
- data/rbi/whop_sdk/resources/webhooks.rbi +3 -1
- data/sig/whop_sdk/client.rbs +5 -1
- data/sig/whop_sdk/models/access_token_create_params.rbs +14 -29
- data/sig/whop_sdk/models/card_brands.rbs +2 -0
- data/sig/whop_sdk/models/checkout_configuration_create_params.rbs +5 -5
- data/sig/whop_sdk/models/company.rbs +2 -0
- data/sig/whop_sdk/models/currency.rbs +2 -0
- data/sig/whop_sdk/models/dispute.rbs +437 -0
- data/sig/whop_sdk/models/dispute_created_webhook_event.rbs +40 -0
- data/sig/whop_sdk/models/dispute_list_params.rbs +51 -0
- data/sig/whop_sdk/models/dispute_list_response.rbs +124 -0
- data/sig/whop_sdk/models/dispute_retrieve_params.rbs +15 -0
- data/sig/whop_sdk/models/dispute_statuses.rbs +30 -0
- data/sig/whop_sdk/models/dispute_submit_evidence_params.rbs +15 -0
- data/sig/whop_sdk/models/dispute_update_evidence_params.rbs +215 -0
- data/sig/whop_sdk/models/dispute_updated_webhook_event.rbs +40 -0
- data/sig/whop_sdk/models/forum_post_create_params.rbs +17 -1
- data/sig/whop_sdk/models/forum_post_update_params.rbs +17 -1
- data/sig/whop_sdk/models/ledger_account_retrieve_response.rbs +2 -0
- data/sig/whop_sdk/models/notification_create_params.rbs +61 -0
- data/sig/whop_sdk/models/notification_create_response.rbs +13 -0
- data/sig/whop_sdk/models/shipment.rbs +4 -4
- data/sig/whop_sdk/models/shipment_list_response.rbs +4 -4
- data/sig/whop_sdk/models/unwrap_webhook_event.rbs +2 -0
- data/sig/whop_sdk/models.rbs +18 -0
- data/sig/whop_sdk/resources/access_tokens.rbs +3 -3
- data/sig/whop_sdk/resources/disputes.rbs +46 -0
- data/sig/whop_sdk/resources/forum_posts.rbs +2 -0
- data/sig/whop_sdk/resources/notifications.rbs +19 -0
- data/sig/whop_sdk/resources/webhooks.rbs +3 -1
- metadata +41 -2
data/lib/whop_sdk/models.rb
CHANGED
|
@@ -170,6 +170,22 @@ module WhopSDK
|
|
|
170
170
|
|
|
171
171
|
Direction = WhopSDK::Models::Direction
|
|
172
172
|
|
|
173
|
+
Dispute = WhopSDK::Models::Dispute
|
|
174
|
+
|
|
175
|
+
DisputeCreatedWebhookEvent = WhopSDK::Models::DisputeCreatedWebhookEvent
|
|
176
|
+
|
|
177
|
+
DisputeListParams = WhopSDK::Models::DisputeListParams
|
|
178
|
+
|
|
179
|
+
DisputeRetrieveParams = WhopSDK::Models::DisputeRetrieveParams
|
|
180
|
+
|
|
181
|
+
DisputeStatuses = WhopSDK::Models::DisputeStatuses
|
|
182
|
+
|
|
183
|
+
DisputeSubmitEvidenceParams = WhopSDK::Models::DisputeSubmitEvidenceParams
|
|
184
|
+
|
|
185
|
+
DisputeUpdatedWebhookEvent = WhopSDK::Models::DisputeUpdatedWebhookEvent
|
|
186
|
+
|
|
187
|
+
DisputeUpdateEvidenceParams = WhopSDK::Models::DisputeUpdateEvidenceParams
|
|
188
|
+
|
|
173
189
|
DmsPostTypes = WhopSDK::Models::DmsPostTypes
|
|
174
190
|
|
|
175
191
|
EmailNotificationPreferences = WhopSDK::Models::EmailNotificationPreferences
|
|
@@ -308,6 +324,8 @@ module WhopSDK
|
|
|
308
324
|
|
|
309
325
|
MessageUpdateParams = WhopSDK::Models::MessageUpdateParams
|
|
310
326
|
|
|
327
|
+
NotificationCreateParams = WhopSDK::Models::NotificationCreateParams
|
|
328
|
+
|
|
311
329
|
PageInfo = WhopSDK::Models::PageInfo
|
|
312
330
|
|
|
313
331
|
Payment = WhopSDK::Models::Payment
|
|
@@ -6,19 +6,21 @@ module WhopSDK
|
|
|
6
6
|
# Some parameter documentations has been truncated, see
|
|
7
7
|
# {WhopSDK::Models::AccessTokenCreateParams} for more details.
|
|
8
8
|
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
9
|
+
# Create a short-lived access token to authenticate API requests on behalf of a
|
|
10
|
+
# Company or User. This token should be used with Whop's web and mobile embedded
|
|
11
|
+
# components. You must provide either a company_id or a user_id argument, but not
|
|
12
|
+
# both.
|
|
11
13
|
#
|
|
12
|
-
# @overload create(
|
|
14
|
+
# @overload create(company_id:, user_id:, expires_at: nil, scoped_actions: nil, request_options: {})
|
|
13
15
|
#
|
|
14
|
-
# @param
|
|
16
|
+
# @param company_id [String] The ID of the Company to generate the token for. The API key must have permissio
|
|
15
17
|
#
|
|
16
|
-
# @param
|
|
17
|
-
#
|
|
18
|
-
# @param target_resource_type [Symbol, WhopSDK::Models::AccessTokenCreateParams::TargetResourceType] The type of the target resource (company, user, product, experience, etc.).
|
|
18
|
+
# @param user_id [String] The ID of the User to generate the token for. The API key must have permission t
|
|
19
19
|
#
|
|
20
20
|
# @param expires_at [Time, nil] The expiration timestamp for the access token. If not provided, a default expira
|
|
21
21
|
#
|
|
22
|
+
# @param scoped_actions [Array<String>, nil] Array of desired scoped actions for the access token. If sent as an empty array
|
|
23
|
+
#
|
|
22
24
|
# @param request_options [WhopSDK::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
23
25
|
#
|
|
24
26
|
# @return [WhopSDK::Models::AccessTokenCreateResponse]
|
|
@@ -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
|
|
@@ -12,7 +12,7 @@ module WhopSDK
|
|
|
12
12
|
#
|
|
13
13
|
# - `forum:post:create`
|
|
14
14
|
#
|
|
15
|
-
# @overload create(experience_id:, attachments: nil, content: nil, is_mention: nil, parent_id: nil, paywall_amount: nil, paywall_currency: nil, pinned: nil, poll: nil, title: nil, request_options: {})
|
|
15
|
+
# @overload create(experience_id:, attachments: nil, content: nil, is_mention: nil, parent_id: nil, paywall_amount: nil, paywall_currency: nil, pinned: nil, poll: nil, title: nil, visibility: nil, request_options: {})
|
|
16
16
|
#
|
|
17
17
|
# @param experience_id [String] The experience to create this post in
|
|
18
18
|
#
|
|
@@ -34,6 +34,8 @@ module WhopSDK
|
|
|
34
34
|
#
|
|
35
35
|
# @param title [String, nil] The title of the post. Only visible if paywalled.
|
|
36
36
|
#
|
|
37
|
+
# @param visibility [Symbol, WhopSDK::Models::ForumPostCreateParams::Visibility, nil] The visibility types for forum posts
|
|
38
|
+
#
|
|
37
39
|
# @param request_options [WhopSDK::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
38
40
|
#
|
|
39
41
|
# @return [WhopSDK::Models::ForumPost]
|
|
@@ -79,7 +81,7 @@ module WhopSDK
|
|
|
79
81
|
#
|
|
80
82
|
# Update an existing forum post
|
|
81
83
|
#
|
|
82
|
-
# @overload update(id, attachments: nil, content: nil, is_pinned: nil, title: nil, request_options: {})
|
|
84
|
+
# @overload update(id, attachments: nil, content: nil, is_pinned: nil, title: nil, visibility: nil, request_options: {})
|
|
83
85
|
#
|
|
84
86
|
# @param id [String] The ID of the forum post to update
|
|
85
87
|
#
|
|
@@ -91,6 +93,8 @@ module WhopSDK
|
|
|
91
93
|
#
|
|
92
94
|
# @param title [String, nil] The title of the post. Only visible if paywalled.
|
|
93
95
|
#
|
|
96
|
+
# @param visibility [Symbol, WhopSDK::Models::ForumPostUpdateParams::Visibility, nil] The visibility types for forum posts
|
|
97
|
+
#
|
|
94
98
|
# @param request_options [WhopSDK::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
95
99
|
#
|
|
96
100
|
# @return [WhopSDK::Models::ForumPost]
|
|
@@ -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)
|
data/lib/whop_sdk/version.rb
CHANGED
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"
|
data/rbi/whop_sdk/client.rbi
CHANGED
|
@@ -14,7 +14,9 @@ module WhopSDK
|
|
|
14
14
|
sig { returns(String) }
|
|
15
15
|
attr_reader :api_key
|
|
16
16
|
|
|
17
|
-
|
|
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
|
-
#
|
|
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"]`
|
|
@@ -11,21 +11,11 @@ module WhopSDK
|
|
|
11
11
|
T.any(WhopSDK::AccessTokenCreateParams, WhopSDK::Internal::AnyHash)
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
|
|
17
|
-
attr_accessor :scoped_actions
|
|
18
|
-
|
|
19
|
-
# The ID of the target resource (Company, User, etc.) for which the access token
|
|
20
|
-
# is being created.
|
|
14
|
+
# The ID of the Company to generate the token for. The API key must have
|
|
15
|
+
# permission to access this Company, such as the being the company the API key
|
|
16
|
+
# belongs to or a sub-merchant of it
|
|
21
17
|
sig { returns(String) }
|
|
22
|
-
attr_accessor :
|
|
23
|
-
|
|
24
|
-
# The type of the target resource (company, user, product, experience, etc.).
|
|
25
|
-
sig do
|
|
26
|
-
returns(WhopSDK::AccessTokenCreateParams::TargetResourceType::OrSymbol)
|
|
27
|
-
end
|
|
28
|
-
attr_accessor :target_resource_type
|
|
18
|
+
attr_accessor :company_id
|
|
29
19
|
|
|
30
20
|
# The expiration timestamp for the access token. If not provided, a default
|
|
31
21
|
# expiration time of 1 hour will be used. The expiration can be set to a maximum
|
|
@@ -33,29 +23,44 @@ module WhopSDK
|
|
|
33
23
|
sig { returns(T.nilable(Time)) }
|
|
34
24
|
attr_accessor :expires_at
|
|
35
25
|
|
|
26
|
+
# Array of desired scoped actions for the access token. If sent as an empty array
|
|
27
|
+
# or not provided, all permissions from the API key making the request will be
|
|
28
|
+
# available on the token. If sending an explicit list, they must be a subset of
|
|
29
|
+
# the API keys's existing permissions. Otherwise, an error will be raised.
|
|
30
|
+
sig { returns(T.nilable(T::Array[String])) }
|
|
31
|
+
attr_accessor :scoped_actions
|
|
32
|
+
|
|
33
|
+
# The ID of the User to generate the token for. The API key must have permission
|
|
34
|
+
# to access this User.
|
|
35
|
+
sig { returns(String) }
|
|
36
|
+
attr_accessor :user_id
|
|
37
|
+
|
|
36
38
|
sig do
|
|
37
39
|
params(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
target_resource_type:
|
|
41
|
-
WhopSDK::AccessTokenCreateParams::TargetResourceType::OrSymbol,
|
|
40
|
+
company_id: String,
|
|
41
|
+
user_id: String,
|
|
42
42
|
expires_at: T.nilable(Time),
|
|
43
|
+
scoped_actions: T.nilable(T::Array[String]),
|
|
43
44
|
request_options: WhopSDK::RequestOptions::OrHash
|
|
44
45
|
).returns(T.attached_class)
|
|
45
46
|
end
|
|
46
47
|
def self.new(
|
|
47
|
-
#
|
|
48
|
-
#
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
#
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
target_resource_type:,
|
|
48
|
+
# The ID of the Company to generate the token for. The API key must have
|
|
49
|
+
# permission to access this Company, such as the being the company the API key
|
|
50
|
+
# belongs to or a sub-merchant of it
|
|
51
|
+
company_id:,
|
|
52
|
+
# The ID of the User to generate the token for. The API key must have permission
|
|
53
|
+
# to access this User.
|
|
54
|
+
user_id:,
|
|
55
55
|
# The expiration timestamp for the access token. If not provided, a default
|
|
56
56
|
# expiration time of 1 hour will be used. The expiration can be set to a maximum
|
|
57
57
|
# of 3 hours from the current time.
|
|
58
58
|
expires_at: nil,
|
|
59
|
+
# Array of desired scoped actions for the access token. If sent as an empty array
|
|
60
|
+
# or not provided, all permissions from the API key making the request will be
|
|
61
|
+
# available on the token. If sending an explicit list, they must be a subset of
|
|
62
|
+
# the API keys's existing permissions. Otherwise, an error will be raised.
|
|
63
|
+
scoped_actions: nil,
|
|
59
64
|
request_options: {}
|
|
60
65
|
)
|
|
61
66
|
end
|
|
@@ -63,64 +68,16 @@ module WhopSDK
|
|
|
63
68
|
sig do
|
|
64
69
|
override.returns(
|
|
65
70
|
{
|
|
66
|
-
|
|
67
|
-
target_resource_id: String,
|
|
68
|
-
target_resource_type:
|
|
69
|
-
WhopSDK::AccessTokenCreateParams::TargetResourceType::OrSymbol,
|
|
71
|
+
company_id: String,
|
|
70
72
|
expires_at: T.nilable(Time),
|
|
73
|
+
scoped_actions: T.nilable(T::Array[String]),
|
|
74
|
+
user_id: String,
|
|
71
75
|
request_options: WhopSDK::RequestOptions
|
|
72
76
|
}
|
|
73
77
|
)
|
|
74
78
|
end
|
|
75
79
|
def to_hash
|
|
76
80
|
end
|
|
77
|
-
|
|
78
|
-
# The type of the target resource (company, user, product, experience, etc.).
|
|
79
|
-
module TargetResourceType
|
|
80
|
-
extend WhopSDK::Internal::Type::Enum
|
|
81
|
-
|
|
82
|
-
TaggedSymbol =
|
|
83
|
-
T.type_alias do
|
|
84
|
-
T.all(Symbol, WhopSDK::AccessTokenCreateParams::TargetResourceType)
|
|
85
|
-
end
|
|
86
|
-
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
87
|
-
|
|
88
|
-
COMPANY =
|
|
89
|
-
T.let(
|
|
90
|
-
:company,
|
|
91
|
-
WhopSDK::AccessTokenCreateParams::TargetResourceType::TaggedSymbol
|
|
92
|
-
)
|
|
93
|
-
PRODUCT =
|
|
94
|
-
T.let(
|
|
95
|
-
:product,
|
|
96
|
-
WhopSDK::AccessTokenCreateParams::TargetResourceType::TaggedSymbol
|
|
97
|
-
)
|
|
98
|
-
EXPERIENCE =
|
|
99
|
-
T.let(
|
|
100
|
-
:experience,
|
|
101
|
-
WhopSDK::AccessTokenCreateParams::TargetResourceType::TaggedSymbol
|
|
102
|
-
)
|
|
103
|
-
APP =
|
|
104
|
-
T.let(
|
|
105
|
-
:app,
|
|
106
|
-
WhopSDK::AccessTokenCreateParams::TargetResourceType::TaggedSymbol
|
|
107
|
-
)
|
|
108
|
-
USER =
|
|
109
|
-
T.let(
|
|
110
|
-
:user,
|
|
111
|
-
WhopSDK::AccessTokenCreateParams::TargetResourceType::TaggedSymbol
|
|
112
|
-
)
|
|
113
|
-
|
|
114
|
-
sig do
|
|
115
|
-
override.returns(
|
|
116
|
-
T::Array[
|
|
117
|
-
WhopSDK::AccessTokenCreateParams::TargetResourceType::TaggedSymbol
|
|
118
|
-
]
|
|
119
|
-
)
|
|
120
|
-
end
|
|
121
|
-
def self.values
|
|
122
|
-
end
|
|
123
|
-
end
|
|
124
81
|
end
|
|
125
82
|
end
|
|
126
83
|
end
|
|
@@ -25,6 +25,7 @@ module WhopSDK
|
|
|
25
25
|
RUPAY = T.let(:rupay, WhopSDK::CardBrands::TaggedSymbol)
|
|
26
26
|
JCBRUPAY = T.let(:jcbrupay, WhopSDK::CardBrands::TaggedSymbol)
|
|
27
27
|
ELO = T.let(:elo, WhopSDK::CardBrands::TaggedSymbol)
|
|
28
|
+
MAESTRO = T.let(:maestro, WhopSDK::CardBrands::TaggedSymbol)
|
|
28
29
|
UNKNOWN = T.let(:unknown, WhopSDK::CardBrands::TaggedSymbol)
|
|
29
30
|
|
|
30
31
|
sig { override.returns(T::Array[WhopSDK::CardBrands::TaggedSymbol]) }
|
|
@@ -94,14 +94,14 @@ module WhopSDK
|
|
|
94
94
|
sig { returns(String) }
|
|
95
95
|
attr_accessor :company_id
|
|
96
96
|
|
|
97
|
+
# The respective currency identifier for the plan.
|
|
98
|
+
sig { returns(WhopSDK::Currency::OrSymbol) }
|
|
99
|
+
attr_accessor :currency
|
|
100
|
+
|
|
97
101
|
# The interval at which the plan charges (renewal plans).
|
|
98
102
|
sig { returns(T.nilable(Integer)) }
|
|
99
103
|
attr_accessor :billing_period
|
|
100
104
|
|
|
101
|
-
# The available currencies on the platform
|
|
102
|
-
sig { returns(T.nilable(WhopSDK::Currency::OrSymbol)) }
|
|
103
|
-
attr_accessor :currency
|
|
104
|
-
|
|
105
105
|
# An array of custom field objects.
|
|
106
106
|
sig do
|
|
107
107
|
returns(
|
|
@@ -225,8 +225,8 @@ module WhopSDK
|
|
|
225
225
|
sig do
|
|
226
226
|
params(
|
|
227
227
|
company_id: String,
|
|
228
|
+
currency: WhopSDK::Currency::OrSymbol,
|
|
228
229
|
billing_period: T.nilable(Integer),
|
|
229
|
-
currency: T.nilable(WhopSDK::Currency::OrSymbol),
|
|
230
230
|
custom_fields:
|
|
231
231
|
T.nilable(
|
|
232
232
|
T::Array[
|
|
@@ -266,10 +266,10 @@ module WhopSDK
|
|
|
266
266
|
def self.new(
|
|
267
267
|
# The company the plan should be created for.
|
|
268
268
|
company_id:,
|
|
269
|
+
# The respective currency identifier for the plan.
|
|
270
|
+
currency:,
|
|
269
271
|
# The interval at which the plan charges (renewal plans).
|
|
270
272
|
billing_period: nil,
|
|
271
|
-
# The available currencies on the platform
|
|
272
|
-
currency: nil,
|
|
273
273
|
# An array of custom field objects.
|
|
274
274
|
custom_fields: nil,
|
|
275
275
|
# The description of the plan.
|
|
@@ -315,8 +315,8 @@ module WhopSDK
|
|
|
315
315
|
override.returns(
|
|
316
316
|
{
|
|
317
317
|
company_id: String,
|
|
318
|
+
currency: WhopSDK::Currency::OrSymbol,
|
|
318
319
|
billing_period: T.nilable(Integer),
|
|
319
|
-
currency: T.nilable(WhopSDK::Currency::OrSymbol),
|
|
320
320
|
custom_fields:
|
|
321
321
|
T.nilable(
|
|
322
322
|
T::Array[
|
|
@@ -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(
|
|
@@ -93,6 +93,7 @@ module WhopSDK
|
|
|
93
93
|
UZS = T.let(:uzs, WhopSDK::Currency::TaggedSymbol)
|
|
94
94
|
RUB = T.let(:rub, WhopSDK::Currency::TaggedSymbol)
|
|
95
95
|
BTC = T.let(:btc, WhopSDK::Currency::TaggedSymbol)
|
|
96
|
+
CNY = T.let(:cny, WhopSDK::Currency::TaggedSymbol)
|
|
96
97
|
|
|
97
98
|
sig { override.returns(T::Array[WhopSDK::Currency::TaggedSymbol]) }
|
|
98
99
|
def self.values
|