Class: Onlyfans::Resources::Notifications

Inherits:
Object
  • Object
show all
Defined in:
lib/onlyfans/resources/notifications.rb,
lib/onlyfans/resources/notifications/tabs_order.rb

Overview

Endpoints for managingr account notifications

Defined Under Namespace

Classes: TabsOrder

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Notifications

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

Parameters:



113
114
115
116
# File 'lib/onlyfans/resources/notifications.rb', line 113

def initialize(client:)
  @client = client
  @tabs_order = Onlyfans::Resources::Notifications::TabsOrder.new(client: client)
end

Instance Attribute Details

#tabs_orderOnlyfans::Resources::Notifications::TabsOrder (readonly)

Endpoints for managingr account notifications



9
10
11
# File 'lib/onlyfans/resources/notifications.rb', line 9

def tabs_order
  @tabs_order
end

Instance Method Details

#get_counts(account, request_options: {}) ⇒ Onlyfans::Models::NotificationGetCountsResponse

Get a quick overview of all unread notification types

Parameters:

Returns:

See Also:



56
57
58
59
60
61
62
63
# File 'lib/onlyfans/resources/notifications.rb', line 56

def get_counts(, params = {})
  @client.request(
    method: :get,
    path: ["api/%1$s/notifications/counts", ],
    model: Onlyfans::Models::NotificationGetCountsResponse,
    options: params[:request_options]
  )
end

#list(account, from_id: nil, limit: nil, skip_users: nil, type: nil, request_options: {}) ⇒ Onlyfans::Models::NotificationListResponse

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

List all notifications for the account

Parameters:

Returns:

See Also:



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/onlyfans/resources/notifications.rb', line 33

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

#mark_all_as_read(account, request_options: {}) ⇒ Onlyfans::Models::NotificationMarkAllAsReadResponse

Mark all notifications of this account as read

Parameters:

Returns:

See Also:



76
77
78
79
80
81
82
83
# File 'lib/onlyfans/resources/notifications.rb', line 76

def mark_all_as_read(, params = {})
  @client.request(
    method: :post,
    path: ["api/%1$s/notifications/mark-all-as-read", ],
    model: Onlyfans::Models::NotificationMarkAllAsReadResponse,
    options: params[:request_options]
  )
end

#search_users(account, query:, request_options: {}) ⇒ Onlyfans::Models::NotificationSearchUsersResponse

Search users that have appeared in your notifications

Parameters:

  • account (String)

    The Account ID

  • query (String)

    The query to search for. Can be either a name or username.

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

Returns:

See Also:



98
99
100
101
102
103
104
105
106
107
108
# File 'lib/onlyfans/resources/notifications.rb', line 98

def search_users(, params)
  parsed, options = Onlyfans::NotificationSearchUsersParams.dump_request(params)
  query = Onlyfans::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["api/%1$s/notifications/search-users", ],
    query: query,
    model: Onlyfans::Models::NotificationSearchUsersResponse,
    options: options
  )
end