Class: Whop_sdk::BountySubmissions::Client
- Inherits:
-
Object
- Object
- Whop_sdk::BountySubmissions::Client
- Defined in:
- lib/whop_sdk/bounty_submissions/client.rb
Instance Method Summary collapse
-
#create(request_options: {}, **params) ⇒ Whop_sdk::Types::BountySubmission
Creates a submission on a workforce bounty.
-
#delete(request_options: {}, **params) ⇒ Whop_sdk::BountySubmissions::Types::DeleteBountySubmissionsResponse
Cancels the caller's own active attempt on a bounty and discards any accumulated capture clips.
- #initialize(client:) ⇒ void constructor
-
#list(request_options: {}, **params) ⇒ Whop_sdk::BountySubmissions::Types::ListBountySubmissionsResponse
Lists bounty submissions visible to the credential — for a user token, the submissions they authored plus those on bounties they posted; for an account API key, the submissions on the account's bounties.
-
#retrieve(request_options: {}, **params) ⇒ Whop_sdk::Types::BountySubmission
Retrieves one bounty submission the credential can see — one the caller authored, or one on a bounty they posted or their account owns.
-
#submit(request_options: {}, **params) ⇒ Whop_sdk::Types::BountySubmission
Submits a claimed attempt for review.
Constructor Details
#initialize(client:) ⇒ void
9 10 11 |
# File 'lib/whop_sdk/bounty_submissions/client.rb', line 9 def initialize(client:) @client = client end |
Instance Method Details
#create(request_options: {}, **params) ⇒ Whop_sdk::Types::BountySubmission
Creates a submission on a workforce bounty. Include a deliverable payload — any combination of links and
uploaded files, with at least one of the two — and the submission goes straight to review; create is the only
step. For data_capture bounties, omit the deliverable: this starts a claimed attempt whose proof accumulates
server-side, and the separate submit endpoint sends it to review once complete. Requires a user credential —
account API keys cannot author submissions.
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/whop_sdk/bounty_submissions/client.rb', line 102 def create(request_options: {}, **params) params = Whop_sdk::Internal::Types::Utils.normalize_keys(params) request = Whop_sdk::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "bounty_submissions", body: Whop_sdk::BountySubmissions::Types::CreateBountySubmissionsRequest.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Whop_sdk::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Whop_sdk::Types::BountySubmission.load(response.body) else error_class = Whop_sdk::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#delete(request_options: {}, **params) ⇒ Whop_sdk::BountySubmissions::Types::DeleteBountySubmissionsResponse
Cancels the caller's own active attempt on a bounty and discards any accumulated capture clips. Only the worker who started the attempt can cancel it — account API keys cannot.
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/whop_sdk/bounty_submissions/client.rb', line 185 def delete(request_options: {}, **params) params = Whop_sdk::Internal::Types::Utils.normalize_keys(params) request = Whop_sdk::Internal::JSON::Request.new( base_url: [:base_url], method: "DELETE", path: "bounty_submissions/#{URI.encode_uri_component(params[:id].to_s)}", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Whop_sdk::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Whop_sdk::BountySubmissions::Types::DeleteBountySubmissionsResponse.load(response.body) else error_class = Whop_sdk::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#list(request_options: {}, **params) ⇒ Whop_sdk::BountySubmissions::Types::ListBountySubmissionsResponse
Lists bounty submissions visible to the credential — for a user token, the submissions they authored plus those on bounties they posted; for an account API key, the submissions on the account's bounties. For the anonymous view of one bounty's reviewed work, use the submissions list under the bounty instead.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/whop_sdk/bounty_submissions/client.rb', line 40 def list(request_options: {}, **params) params = Whop_sdk::Internal::Types::Utils.normalize_keys(params) query_params = {} query_params["account_id"] = params[:account_id] if params.key?(:account_id) query_params["bounty_id"] = params[:bounty_id] if params.key?(:bounty_id) query_params["status"] = params[:status] if params.key?(:status) query_params["created_after"] = params[:created_after] if params.key?(:created_after) query_params["created_before"] = params[:created_before] if params.key?(:created_before) query_params["order"] = params[:order] if params.key?(:order) query_params["direction"] = params[:direction] if params.key?(:direction) query_params["first"] = params[:first] if params.key?(:first) query_params["after"] = params[:after] if params.key?(:after) query_params["last"] = params[:last] if params.key?(:last) query_params["before"] = params[:before] if params.key?(:before) Whop_sdk::Internal::CursorItemIterator.new( cursor_field: :end_cursor, item_field: :data, initial_cursor: query_params["after"] ) do |next_cursor| query_params["after"] = next_cursor request = Whop_sdk::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "bounty_submissions", query: query_params, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Whop_sdk::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) parsed_response = Whop_sdk::BountySubmissions::Types::ListBountySubmissionsResponse.load(response.body) [parsed_response, response] else error_class = Whop_sdk::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end end |
#retrieve(request_options: {}, **params) ⇒ Whop_sdk::Types::BountySubmission
Retrieves one bounty submission the credential can see — one the caller authored, or one on a bounty they posted
or their account owns. Reading another member's work on an account's bounty takes account_id, the same way the
list does.
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/whop_sdk/bounty_submissions/client.rb', line 143 def retrieve(request_options: {}, **params) params = Whop_sdk::Internal::Types::Utils.normalize_keys(params) query_params = {} query_params["account_id"] = params[:account_id] if params.key?(:account_id) request = Whop_sdk::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "bounty_submissions/#{URI.encode_uri_component(params[:id].to_s)}", query: query_params, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Whop_sdk::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Whop_sdk::Types::BountySubmission.load(response.body) else error_class = Whop_sdk::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#submit(request_options: {}, **params) ⇒ Whop_sdk::Types::BountySubmission
Submits a claimed attempt for review. A livestream attempt needs an ended proof stream and can attach an
optional deliverable — links, files, and a caption in any combination; if the attempt already went to review
when its stream ended, the payload attaches to it once, until reviewers start voting. A data capture attempt
instead needs enough validated clip time and takes no payload. Only the worker who started the attempt can
submit it — account API keys cannot.
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 |
# File 'lib/whop_sdk/bounty_submissions/client.rb', line 226 def submit(request_options: {}, **params) params = Whop_sdk::Internal::Types::Utils.normalize_keys(params) request_data = Whop_sdk::BountySubmissions::Types::SubmitBountySubmissionsRequest.new(params).to_h non_body_param_names = %w[id] body = request_data.except(*non_body_param_names) request = Whop_sdk::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "bounty_submissions/#{URI.encode_uri_component(params[:id].to_s)}/submit", body: body, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Whop_sdk::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Whop_sdk::Types::BountySubmission.load(response.body) else error_class = Whop_sdk::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |