Class: Onlyfans::Resources::UserLists

Inherits:
Object
  • Object
show all
Defined in:
lib/onlyfans/resources/user_lists.rb,
lib/onlyfans/resources/user_lists/users.rb

Defined Under Namespace

Classes: Users

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ UserLists

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

Parameters:



155
156
157
158
# File 'lib/onlyfans/resources/user_lists.rb', line 155

def initialize(client:)
  @client = client
  @users = Onlyfans::Resources::UserLists::Users.new(client: client)
end

Instance Attribute Details

#usersOnlyfans::Resources::UserLists::Users (readonly)



7
8
9
# File 'lib/onlyfans/resources/user_lists.rb', line 7

def users
  @users
end

Instance Method Details

#create(account, name:, request_options: {}) ⇒ Onlyfans::Models::UserListCreateResponse

Create a OnlyFans User List

Parameters:

  • account (String)

    The Account ID

  • name (String)

    Must not be greater than 64 characters.

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

Returns:

See Also:



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

def create(, params)
  parsed, options = Onlyfans::UserListCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["api/%1$s/user-lists", ],
    body: parsed,
    model: Onlyfans::Models::UserListCreateResponse,
    options: options
  )
end

#delete(user_list_id, account:, request_options: {}) ⇒ Onlyfans::Models::UserListDeleteResponse

Delete a OnlyFans User List

Parameters:

  • user_list_id (String)

    OnlyFans User List ID, or a default list name like ‘tagged`

  • account (String)

    The Account ID

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

Returns:

See Also:



138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/onlyfans/resources/user_lists.rb', line 138

def delete(user_list_id, params)
  parsed, options = Onlyfans::UserListDeleteParams.dump_request(params)
   =
    parsed.delete(:account) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :delete,
    path: ["api/%1$s/user-lists/%2$s", , user_list_id],
    model: Onlyfans::Models::UserListDeleteResponse,
    options: options
  )
end

#list(account, limit: nil, offset: nil, request_options: {}) ⇒ Onlyfans::Models::UserListListResponse

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

Get a list of OnlyFans Collections - User Lists

Parameters:

  • account (String)

    The Account ID

  • limit (Integer, nil)

    How many results to return in the request. Max. 50 user lists. Must be at least

  • offset (Integer, nil)

    Must be at least 0.

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

Returns:

See Also:



113
114
115
116
117
118
119
120
121
122
123
# File 'lib/onlyfans/resources/user_lists.rb', line 113

def list(, params = {})
  parsed, options = Onlyfans::UserListListParams.dump_request(params)
  query = Onlyfans::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["api/%1$s/user-lists", ],
    query: query,
    model: Onlyfans::Models::UserListListResponse,
    options: options
  )
end

#retrieve(user_list_id, account:, request_options: {}) ⇒ Onlyfans::Models::UserListRetrieveResponse

Get a user list

Parameters:

  • user_list_id (String)

    OnlyFans User List ID, or a default list name like ‘tagged`

  • account (String)

    The Account ID

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

Returns:

See Also:



46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/onlyfans/resources/user_lists.rb', line 46

def retrieve(user_list_id, params)
  parsed, options = Onlyfans::UserListRetrieveParams.dump_request(params)
   =
    parsed.delete(:account) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["api/%1$s/user-lists/%2$s", , user_list_id],
    model: Onlyfans::Models::UserListRetrieveResponse,
    options: options
  )
end

#update(user_list_id, account:, name:, is_pinned_to_feed: nil, request_options: {}) ⇒ Onlyfans::Models::UserListUpdateResponse

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

Update a OnlyFans User List

Parameters:

  • user_list_id (String)

    Path param: OnlyFans User List ID, or a default list name like ‘tagged`

  • account (String)

    Path param: The Account ID

  • name (String)

    Body param: The new name for the User List.

  • is_pinned_to_feed (Boolean, nil)

    Body param: Whether to pin the User List to feed to the OnlyFans homepage or not

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

Returns:

See Also:



80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/onlyfans/resources/user_lists.rb', line 80

def update(user_list_id, params)
  parsed, options = Onlyfans::UserListUpdateParams.dump_request(params)
   =
    parsed.delete(:account) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :put,
    path: ["api/%1$s/user-lists/%2$s", , user_list_id],
    body: parsed,
    model: Onlyfans::Models::UserListUpdateResponse,
    options: options
  )
end