Class: WhopSDK::Resources::Bounties

Inherits:
Object
  • Object
show all
Defined in:
lib/whop_sdk/resources/bounties.rb

Overview

Bounties

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Bounties

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Bounties.

Parameters:



119
120
121
# File 'lib/whop_sdk/resources/bounties.rb', line 119

def initialize(client:)
  @client = client
end

Instance Method Details

#create(base_unit_amount:, currency:, description:, title:, accepted_submissions_limit: nil, allowed_country_codes: nil, experience_id: nil, origin_account_id: nil, post_markdown_content: nil, post_title: nil, request_options: {}) ⇒ WhopSDK::Models::BountyCreateResponse

Some parameter documentations has been truncated, see Models::BountyCreateParams for more details.

Create a new workforce bounty by funding a dedicated bounty pool.

Required permissions:

  • ‘bounty:create`

D

Parameters:

  • base_unit_amount (Float)

    The amount paid to each approved submission. The total bounty pool funded is thi

  • currency (Symbol, WhopSDK::Models::Currency)

    The currency for the bounty pool funding amount.

  • description (String)

    The description of the bounty.

  • title (String)

    The title of the bounty.

  • accepted_submissions_limit (Integer, nil)

    The number of submissions that can be approved before the bounty closes. Default

  • allowed_country_codes (Array<String>, nil)

    The ISO3166 country codes where this bounty should be visible. Empty means globa

  • experience_id (String, nil)

    An optional experience to scope the bounty to.

  • origin_account_id (String, nil)

    The user (user**) or company (biz**) tag whose balance funds this bounty pool.

  • post_markdown_content (String, nil)

    Optional markdown body for the anchor forum post. Falls back to the bounty descr

  • post_title (String, nil)

    Optional title for the anchor forum post. Falls back to the bounty title when om

  • request_options (WhopSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



44
45
46
47
48
49
50
51
52
53
# File 'lib/whop_sdk/resources/bounties.rb', line 44

def create(params)
  parsed, options = WhopSDK::BountyCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "bounties",
    body: parsed,
    model: WhopSDK::Models::BountyCreateResponse,
    options: options
  )
end

#list(after: nil, before: nil, direction: nil, experience_id: nil, first: nil, last: nil, status: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::BountyListResponse>

Some parameter documentations has been truncated, see Models::BountyListParams for more details.

Returns a paginated list of workforce bounties. When experienceId is provided, returns bounties scoped to that experience. When omitted, returns bounties with no experience.

Parameters:

  • after (String, nil)

    Returns the elements in the list that come after the specified cursor.

  • before (String, nil)

    Returns the elements in the list that come before the specified cursor.

  • direction (Symbol, WhopSDK::Models::Direction, nil)

    The direction of the sort.

  • experience_id (String, nil)

    The experience to list bounties for. When omitted, returns bounties with no expe

  • first (Integer, nil)

    Returns the first n elements from the list.

  • last (Integer, nil)

    Returns the last n elements from the list.

  • status (Symbol, WhopSDK::Models::BountyListParams::Status, nil)

    The available bounty statuses to choose from.

  • request_options (WhopSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/whop_sdk/resources/bounties.rb', line 103

def list(params = {})
  parsed, options = WhopSDK::BountyListParams.dump_request(params)
  query = WhopSDK::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "bounties",
    query: query,
    page: WhopSDK::Internal::CursorPage,
    model: WhopSDK::Models::BountyListResponse,
    options: options
  )
end

#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::BountyRetrieveResponse

Retrieves a workforce bounty for the current authenticated user.

Parameters:

  • id (String)

    The unique identifier of the workforce bounty to retrieve.

  • request_options (WhopSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



66
67
68
69
70
71
72
73
# File 'lib/whop_sdk/resources/bounties.rb', line 66

def retrieve(id, params = {})
  @client.request(
    method: :get,
    path: ["bounties/%1$s", id],
    model: WhopSDK::Models::BountyRetrieveResponse,
    options: params[:request_options]
  )
end