Module: Shikimori::API::V1::Appear

Included in:
Shikimori::API::V1
Defined in:
lib/shikimori/api/v1/appear.rb

Overview

Methods for the Appears API

Instance Method Summary collapse

Instance Method Details

#create_appear(comment_ids: [], topic_ids: [], headers: nil, **query) ⇒ Boolean

Mark comments or topics as read

Examples:

Mark comment 7, 8 and topic 270101 as read

client = Shikimori::API::Client.new(
  app_name: 'Api Test',
  aceess_token: '****',
  refresh_token: '****'
)
client.v1.create_appear(ids: ["comment-7", "comment-8","topic-270101"]) #=> true

Parameters:

  • comment_ids (Array<#to_s>) (defaults to: [])

    Comment ids

  • topic_ids (Array<#to_s>) (defaults to: [])

    Topic ids

  • headers (Hash) (defaults to: nil)

    Request headers

  • query (Hash)

    Query string parameters for request

Returns:

  • (Boolean)

    True if mark comments or topics as read successful, false otherwise.

See Also:



27
28
29
30
31
32
33
34
35
36
# File 'lib/shikimori/api/v1/appear.rb', line 27

def create_appear(comment_ids: [], topic_ids: [], headers: nil, **query)
  comments = comment_ids.map { "comment-#{_1}" }
  topics = topic_ids.map { "topic-#{_1}" }

  ids = comments + topics

  rest.post base_url.join('appear').url, { ids: ids.join(',') }, headers: headers, query: query

  true
end