Class: WhopSDK::Resources::Experiences

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Experiences

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 Experiences.

Parameters:



210
211
212
# File 'lib/whop_sdk/resources/experiences.rb', line 210

def initialize(client:)
  @client = client
end

Instance Method Details

#attach(id, product_id: , request_options: {}) ⇒ WhopSDK::Models::Experience

Adds an experience to an product, making it accessible to the product’s customers.

Required permissions:

  • ‘experience:attach`

Parameters:

  • id (String)
  • product_id (String)

    The ID of the Access Pass to add the Experience to.

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

Returns:

See Also:



167
168
169
170
171
172
173
174
175
176
# File 'lib/whop_sdk/resources/experiences.rb', line 167

def attach(id, params)
  parsed, options = WhopSDK::ExperienceAttachParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["experiences/%1$s/attach", id],
    body: parsed,
    model: WhopSDK::Experience,
    options: options
  )
end

#create(app_id: , company_id: , name: nil, section_id: nil, request_options: {}) ⇒ WhopSDK::Models::Experience

Required permissions:

  • ‘experience:create`

Parameters:

  • app_id (String)

    The ID of the app to create the experience for

  • company_id (String)

    The ID of the company to create the experience for

  • name (String, nil)

    The name of the experience

  • section_id (String, nil)

    The ID of the section to create the experience in

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

Returns:

See Also:



25
26
27
28
29
30
31
32
33
34
# File 'lib/whop_sdk/resources/experiences.rb', line 25

def create(params)
  parsed, options = WhopSDK::ExperienceCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "experiences",
    body: parsed,
    model: WhopSDK::Experience,
    options: options
  )
end

#delete(id, request_options: {}) ⇒ Boolean

Required permissions:

  • ‘experience:delete`

Parameters:

Returns:

  • (Boolean)

See Also:



140
141
142
143
144
145
146
147
# File 'lib/whop_sdk/resources/experiences.rb', line 140

def delete(id, params = {})
  @client.request(
    method: :delete,
    path: ["experiences/%1$s", id],
    model: WhopSDK::Internal::Type::Boolean,
    options: params[:request_options]
  )
end

#detach(id, product_id: , request_options: {}) ⇒ WhopSDK::Models::Experience

Removes an experience from an product, making it inaccessible to the product’s customers.

Required permissions:

  • ‘experience:detach`

Parameters:

  • id (String)
  • product_id (String)

    The ID of the Access Pass to add the Experience to.

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

Returns:

See Also:



196
197
198
199
200
201
202
203
204
205
# File 'lib/whop_sdk/resources/experiences.rb', line 196

def detach(id, params)
  parsed, options = WhopSDK::ExperienceDetachParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["experiences/%1$s/detach", id],
    body: parsed,
    model: WhopSDK::Experience,
    options: options
  )
end

#list(company_id: , after: nil, app_id: nil, before: nil, first: nil, last: nil, product_id: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::ExperienceListResponse>

Lists experiences for a company

Required permissions:

  • ‘experience:hidden_experience:read`

Parameters:

  • company_id (String)

    The ID of the company to filter experiences by

  • after (String, nil)

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

  • app_id (String, nil)

    The ID of the app to filter experiences by

  • before (String, nil)

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

  • first (Integer, nil)

    Returns the first n elements from the list.

  • last (Integer, nil)

    Returns the last n elements from the list.

  • product_id (String, nil)

    The ID of the product to filter experiences by

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

Returns:

See Also:



116
117
118
119
120
121
122
123
124
125
126
# File 'lib/whop_sdk/resources/experiences.rb', line 116

def list(params)
  parsed, options = WhopSDK::ExperienceListParams.dump_request(params)
  @client.request(
    method: :get,
    path: "experiences",
    query: parsed,
    page: WhopSDK::Internal::CursorPage,
    model: WhopSDK::Models::ExperienceListResponse,
    options: options
  )
end

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

Retrieves an experience by ID

Parameters:

Returns:

See Also:



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

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

#update(id, access_level: nil, logo: nil, name: nil, order: nil, section_id: nil, request_options: {}) ⇒ WhopSDK::Models::Experience

Required permissions:

  • ‘experience:update`

Parameters:

Returns:

See Also:



78
79
80
81
82
83
84
85
86
87
# File 'lib/whop_sdk/resources/experiences.rb', line 78

def update(id, params = {})
  parsed, options = WhopSDK::ExperienceUpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["experiences/%1$s", id],
    body: parsed,
    model: WhopSDK::Experience,
    options: options
  )
end