Class: Onlyfans::Resources::Settings::SocialMediaButtons

Inherits:
Object
  • Object
show all
Defined in:
lib/onlyfans/resources/settings/social_media_buttons.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ SocialMediaButtons

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

Parameters:



139
140
141
# File 'lib/onlyfans/resources/settings/social_media_buttons.rb', line 139

def initialize(client:)
  @client = client
end

Instance Method Details

#add(account, label:, type:, value:, request_options: {}) ⇒ Onlyfans::Models::Settings::SocialMediaButtonAddResponse

Adds a new social media button to the account

Parameters:

Returns:

See Also:



101
102
103
104
105
106
107
108
109
110
# File 'lib/onlyfans/resources/settings/social_media_buttons.rb', line 101

def add(, params)
  parsed, options = Onlyfans::Settings::SocialMediaButtonAddParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["api/%1$s/settings/social-media-buttons", ],
    body: parsed,
    model: Onlyfans::Models::Settings::SocialMediaButtonAddResponse,
    options: options
  )
end

#delete(button_id, account:, request_options: {}) ⇒ Onlyfans::Models::Settings::SocialMediaButtonDeleteResponse

Deletes a social media button from the account

Parameters:

  • button_id (String)

    The ID of the social media button to update

  • account (String)

    The Account ID

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

Returns:

See Also:



70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/onlyfans/resources/settings/social_media_buttons.rb', line 70

def delete(button_id, params)
  parsed, options = Onlyfans::Settings::SocialMediaButtonDeleteParams.dump_request(params)
   =
    parsed.delete(:account) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :delete,
    path: ["api/%1$s/settings/social-media-buttons/%2$s", , button_id],
    model: Onlyfans::Models::Settings::SocialMediaButtonDeleteResponse,
    options: options
  )
end

#list(account, request_options: {}) ⇒ Onlyfans::Models::Settings::SocialMediaButtonListResponse

Returns the list of social media buttons for the account

Parameters:

Returns:

See Also:



48
49
50
51
52
53
54
55
# File 'lib/onlyfans/resources/settings/social_media_buttons.rb', line 48

def list(, params = {})
  @client.request(
    method: :get,
    path: ["api/%1$s/settings/social-media-buttons", ],
    model: Onlyfans::Models::Settings::SocialMediaButtonListResponse,
    options: params[:request_options]
  )
end

#reorder(account, button_ids:, request_options: {}) ⇒ Onlyfans::Models::Settings::SocialMediaButtonReorderResponse

Changes the order of social media buttons for the account

Parameters:

  • account (String)

    The Account ID

  • button_ids (Array<String>)

    The new order of the buttons

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

Returns:

See Also:



125
126
127
128
129
130
131
132
133
134
# File 'lib/onlyfans/resources/settings/social_media_buttons.rb', line 125

def reorder(, params)
  parsed, options = Onlyfans::Settings::SocialMediaButtonReorderParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["api/%1$s/settings/social-media-buttons/reorder", ],
    body: parsed,
    model: Onlyfans::Models::Settings::SocialMediaButtonReorderResponse,
    options: options
  )
end

#update(button_id, account:, label:, request_options: {}) ⇒ Onlyfans::Models::Settings::SocialMediaButtonUpdateResponse

Updates a social media button from the account

Parameters:

  • button_id (String)

    Path param: The ID of the social media button to update

  • account (String)

    Path param: The Account ID

  • label (String)

    Body param: The new label for the button

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

Returns:

See Also:



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

def update(button_id, params)
  parsed, options = Onlyfans::Settings::SocialMediaButtonUpdateParams.dump_request(params)
   =
    parsed.delete(:account) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :put,
    path: ["api/%1$s/settings/social-media-buttons/%2$s", , button_id],
    body: parsed,
    model: Onlyfans::Models::Settings::SocialMediaButtonUpdateResponse,
    options: options
  )
end