Class: Onlyfans::Resources::Media::Vault

Inherits:
Object
  • Object
show all
Defined in:
lib/onlyfans/resources/media/vault.rb,
lib/onlyfans/resources/media/vault/lists.rb,
lib/onlyfans/resources/media/vault/lists/media.rb

Defined Under Namespace

Classes: Lists

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Vault

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

Parameters:



138
139
140
141
# File 'lib/onlyfans/resources/media/vault.rb', line 138

def initialize(client:)
  @client = client
  @lists = Onlyfans::Resources::Media::Vault::Lists.new(client: client)
end

Instance Attribute Details

#listsOnlyfans::Resources::Media::Vault::Lists (readonly)



8
9
10
# File 'lib/onlyfans/resources/media/vault.rb', line 8

def lists
  @lists
end

Instance Method Details

#delete(account, media_ids:, request_options: {}) ⇒ Onlyfans::Models::Media::VaultDeleteResponse

Delete one or multiple media from your vault.

Parameters:

  • account (String)

    The Account ID

  • media_ids (Array<String>)

    Array of media IDs to delete.

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

Returns:

See Also:



92
93
94
95
96
97
98
99
100
101
# File 'lib/onlyfans/resources/media/vault.rb', line 92

def delete(, params)
  parsed, options = Onlyfans::Media::VaultDeleteParams.dump_request(params)
  @client.request(
    method: :delete,
    path: ["api/%1$s/media/vault/delete-media", ],
    body: parsed,
    model: Onlyfans::Models::Media::VaultDeleteResponse,
    options: options
  )
end

#list(account, field: nil, limit: nil, list: nil, offset: nil, query: nil, sort: nil, type: nil, request_options: {}) ⇒ Onlyfans::Models::Media::VaultListResponse

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

List media items stored in your vault. See how many likes and how much tips did they get.

Vaul

Parameters:

Returns:

See Also:



67
68
69
70
71
72
73
74
75
76
77
# File 'lib/onlyfans/resources/media/vault.rb', line 67

def list(, params = {})
  parsed, options = Onlyfans::Media::VaultListParams.dump_request(params)
  query = Onlyfans::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["api/%1$s/media/vault", ],
    query: query,
    model: Onlyfans::Models::Media::VaultListResponse,
    options: options
  )
end

#retrieve(media_id, account:, request_options: {}) ⇒ Onlyfans::Models::Media::VaultRetrieveResponse

Retrieve details about a specific media item in your vault.

Parameters:

  • media_id (Integer)

    The ID of the media item to retrieve.

  • account (String)

    The Account ID

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

Returns:

See Also:



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/onlyfans/resources/media/vault.rb', line 23

def retrieve(media_id, params)
  parsed, options = Onlyfans::Media::VaultRetrieveParams.dump_request(params)
   =
    parsed.delete(:account) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["api/%1$s/media/vault/%2$s", , media_id],
    model: Onlyfans::Models::Media::VaultRetrieveResponse,
    options: options
  )
end

#upload(account, async: nil, file: nil, file_url: nil, request_options: {}) ⇒ Onlyfans::Models::Media::VaultUploadResponse

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

Upload a media file directly to your vault.

Parameters:

  • account (String)

    The Account ID

  • async (Boolean)

    Set to ‘true` to process uploads in the background. Returns a `polling_url` to c

  • file (Pathname, StringIO, IO, String, Onlyfans::FilePart)

    The file to upload. Required if ‘file_url` is not provided. Maximum file size: 1

  • file_url (String)

    A URL to download the file from. Required if ‘file` is not provided. Maximum fil

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

Returns:

See Also:



123
124
125
126
127
128
129
130
131
132
133
# File 'lib/onlyfans/resources/media/vault.rb', line 123

def upload(, params = {})
  parsed, options = Onlyfans::Media::VaultUploadParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["api/%1$s/media/vault", ],
    headers: {"content-type" => "multipart/form-data"},
    body: parsed,
    model: Onlyfans::Models::Media::VaultUploadResponse,
    options: options
  )
end