Class: Onlyfans::Resources::UserLists::Users

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Users

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

Parameters:



199
200
201
# File 'lib/onlyfans/resources/user_lists/users.rb', line 199

def initialize(client:)
  @client = client
end

Instance Method Details

#add(user_list_id, account:, ids:, request_options: {}) ⇒ Onlyfans::Models::UserLists::UserAddResponse

Add multiple Users To 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

  • ids (Array<String>)

    Body param: Array of OnlyFans User IDs to be added into the list

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

Returns:

See Also:



55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/onlyfans/resources/user_lists/users.rb', line 55

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

#clear(user_list_id, account:, request_options: {}) ⇒ Onlyfans::Models::UserLists::UserClearResponse

Remove all users from 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:



83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/onlyfans/resources/user_lists/users.rb', line 83

def clear(user_list_id, params)
  parsed, options = Onlyfans::UserLists::UserClearParams.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/users", , user_list_id],
    model: Onlyfans::Models::UserLists::UserClearResponse,
    options: options
  )
end

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

Get all users in 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

  • limit (String)

    Query param: Number of users to return (1 - 100). Default = 10

  • offset (String)

    Query param: Number of users to skip for pagination

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

Returns:

See Also:



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/onlyfans/resources/user_lists/users.rb', line 24

def list(user_list_id, params)
  parsed, options = Onlyfans::UserLists::UserListParams.dump_request(params)
  query = Onlyfans::Internal::Util.encode_query_params(parsed)
   =
    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/users", , user_list_id],
    query: query,
    model: Onlyfans::Models::UserLists::UserListResponse,
    options: options
  )
end

#list_pinned(user_list_id, account:, limit: nil, offset: nil, request_options: {}) ⇒ Onlyfans::Models::UserLists::UserListPinnedResponse

Get pinned users from an OnlyFans User List.

Parameters:

  • user_list_id (String)

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

  • account (String)

    Path param: The Account ID

  • limit (String)

    Query param: Number of users to return (1 - 100). Default = 10

  • offset (String)

    Query param: Number of users to skip for pagination

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

Returns:

See Also:



114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/onlyfans/resources/user_lists/users.rb', line 114

def list_pinned(user_list_id, params)
  parsed, options = Onlyfans::UserLists::UserListPinnedParams.dump_request(params)
  query = Onlyfans::Internal::Util.encode_query_params(parsed)
   =
    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/users/pinned", , user_list_id],
    query: query,
    model: Onlyfans::Models::UserLists::UserListPinnedResponse,
    options: options
  )
end

#pin(user_id, account:, user_list_id:, request_options: {}) ⇒ Onlyfans::Models::UserLists::UserPinResponse

Pin a user in any OnlyFans user list.

Parameters:

  • user_id (Integer)

    OnlyFans User ID to pin or unpin

  • account (String)

    The Account ID

  • user_list_id (String)

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

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

Returns:

See Also:



145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/onlyfans/resources/user_lists/users.rb', line 145

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

#remove(user_id, account:, user_list_id:, request_options: {}) ⇒ Onlyfans::Models::UserLists::UserRemoveResponse

Remove User from OnlyFans User List

Parameters:

  • user_id (Integer)

    OnlyFans User ID

  • account (String)

    The Account ID

  • user_list_id (String)

    OnlyFans User List ID

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

Returns:

See Also:



178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# File 'lib/onlyfans/resources/user_lists/users.rb', line 178

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