Class: WhopSDK::Resources::Files

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

Overview

Files

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Files

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

Parameters:



56
57
58
# File 'lib/whop_sdk/resources/files.rb', line 56

def initialize(client:)
  @client = client
end

Instance Method Details

#create(filename:, request_options: {}) ⇒ WhopSDK::Models::FileCreateResponse

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

Create a new file record and receive a presigned URL for uploading content to S3.

Parameters:

  • filename (String)

    The name of the file including its extension (e.g., “photo.png” or “document.pdf

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

Returns:

See Also:



22
23
24
25
26
27
28
29
30
31
# File 'lib/whop_sdk/resources/files.rb', line 22

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

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

Retrieves the details of an existing file.

Parameters:

  • id (String)

    The unique identifier of the file to retrieve.

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

Returns:

See Also:



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

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