Class: Onlyfans::Resources::Posts::Labels

Inherits:
Object
  • Object
show all
Defined in:
lib/onlyfans/resources/posts/labels.rb

Overview

APIs for managing your post labels

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Labels

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

Parameters:



62
63
64
# File 'lib/onlyfans/resources/posts/labels.rb', line 62

def initialize(client:)
  @client = client
end

Instance Method Details

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

Create a new post label.

Parameters:

  • account (String)

    The Account ID

  • name (String)

    The name of your new label

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

Returns:

See Also:



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

def create(, params)
  parsed, options = Onlyfans::Posts::LabelCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["api/%1$s/posts/labels", ],
    body: parsed,
    model: Onlyfans::Models::Posts::LabelCreateResponse,
    options: options
  )
end

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

List the labels that you can use to organize your posts.

Parameters:

  • account (String)

    The Account ID

  • limit (String)

    Number of labels to return (default = 10)

  • offset (String)

    Number of labels to skip for pagination

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

Returns:

See Also:



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

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