shikimori-api 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +20 -0
  3. data/lib/shikimori/api/client.rb +34 -0
  4. data/lib/shikimori/api/errors.rb +21 -0
  5. data/lib/shikimori/api/rest.rb +115 -0
  6. data/lib/shikimori/api/uri.rb +18 -0
  7. data/lib/shikimori/api/v1/achievements.rb +32 -0
  8. data/lib/shikimori/api/v1/animes.rb +252 -0
  9. data/lib/shikimori/api/v1/appear.rb +40 -0
  10. data/lib/shikimori/api/v1/bans.rb +31 -0
  11. data/lib/shikimori/api/v1/calendars.rb +32 -0
  12. data/lib/shikimori/api/v1/characters.rb +52 -0
  13. data/lib/shikimori/api/v1/clubs.rb +329 -0
  14. data/lib/shikimori/api/v1/comments.rb +161 -0
  15. data/lib/shikimori/api/v1/constants.rb +107 -0
  16. data/lib/shikimori/api/v1/dialogs.rb +78 -0
  17. data/lib/shikimori/api/v1/favorites.rb +148 -0
  18. data/lib/shikimori/api/v1/forums.rb +31 -0
  19. data/lib/shikimori/api/v1/friends.rb +57 -0
  20. data/lib/shikimori/api/v1/genres.rb +31 -0
  21. data/lib/shikimori/api/v1/ignores.rb +62 -0
  22. data/lib/shikimori/api/v1/mangas.rb +211 -0
  23. data/lib/shikimori/api/v1/messages.rb +168 -0
  24. data/lib/shikimori/api/v1/people.rb +53 -0
  25. data/lib/shikimori/api/v1/publishers.rb +31 -0
  26. data/lib/shikimori/api/v1/ranobe.rb +206 -0
  27. data/lib/shikimori/api/v1/reviews.rb +89 -0
  28. data/lib/shikimori/api/v1/stats.rb +31 -0
  29. data/lib/shikimori/api/v1/studios.rb +31 -0
  30. data/lib/shikimori/api/v1/styles.rb +112 -0
  31. data/lib/shikimori/api/v1/topic_ignores.rb +63 -0
  32. data/lib/shikimori/api/v1/topics.rb +237 -0
  33. data/lib/shikimori/api/v1/user_images.rb +36 -0
  34. data/lib/shikimori/api/v1/user_rates.rb +194 -0
  35. data/lib/shikimori/api/v1/users.rb +310 -0
  36. data/lib/shikimori/api/v1/videos.rb +85 -0
  37. data/lib/shikimori/api/v1.rb +77 -0
  38. data/lib/shikimori/api/v2/abuse_requests.rb +103 -0
  39. data/lib/shikimori/api/v2/episode_notifications.rb +54 -0
  40. data/lib/shikimori/api/v2/topic_ignore.rb +54 -0
  41. data/lib/shikimori/api/v2/user_ignore.rb +54 -0
  42. data/lib/shikimori/api/v2/user_rates.rb +171 -0
  43. data/lib/shikimori/api/v2.rb +27 -0
  44. data/lib/shikimori/api/version.rb +8 -0
  45. data/lib/shikimori/api.rb +14 -0
  46. data/lib/shikimori-api.rb +3 -0
  47. data/shikimori-api.gemspec +40 -0
  48. data/sig/shikimori/api/client.rbs +12 -0
  49. data/sig/shikimori/api/rest.rbs +30 -0
  50. data/sig/shikimori/api/uri.rbs +10 -0
  51. data/sig/shikimori/api/v1/achievements.rbs +15 -0
  52. data/sig/shikimori/api/v1/animes.rbs +23 -0
  53. data/sig/shikimori/api/v1/appear.rbs +15 -0
  54. data/sig/shikimori/api/v1/bans.rbs +15 -0
  55. data/sig/shikimori/api/v1/calendars.rbs +15 -0
  56. data/sig/shikimori/api/v1/characters.rbs +16 -0
  57. data/sig/shikimori/api/v1/clubs.rbs +29 -0
  58. data/sig/shikimori/api/v1/comments.rbs +19 -0
  59. data/sig/shikimori/api/v1/constants.rbs +19 -0
  60. data/sig/shikimori/api/v1/dialogs.rbs +17 -0
  61. data/sig/shikimori/api/v1/favorites.rbs +23 -0
  62. data/sig/shikimori/api/v1/forums.rbs +15 -0
  63. data/sig/shikimori/api/v1/friends.rbs +16 -0
  64. data/sig/shikimori/api/v1/genres.rbs +15 -0
  65. data/sig/shikimori/api/v1/ignores.rbs +16 -0
  66. data/sig/shikimori/api/v1/mangas.rbs +23 -0
  67. data/sig/shikimori/api/v1/messages.rbs +20 -0
  68. data/sig/shikimori/api/v1/people.rbs +16 -0
  69. data/sig/shikimori/api/v1/publishers.rbs +15 -0
  70. data/sig/shikimori/api/v1/ranobe.rbs +23 -0
  71. data/sig/shikimori/api/v1/reviews.rbs +19 -0
  72. data/sig/shikimori/api/v1/stats.rbs +15 -0
  73. data/sig/shikimori/api/v1/studios.rbs +15 -0
  74. data/sig/shikimori/api/v1/styles.rbs +18 -0
  75. data/sig/shikimori/api/v1/topic_ignores.rbs +16 -0
  76. data/sig/shikimori/api/v1/topics.rbs +40 -0
  77. data/sig/shikimori/api/v1/user_images.rbs +15 -0
  78. data/sig/shikimori/api/v1/user_rates.rbs +44 -0
  79. data/sig/shikimori/api/v1/users.rbs +28 -0
  80. data/sig/shikimori/api/v1/videos.rbs +23 -0
  81. data/sig/shikimori/api/v1.rbs +41 -0
  82. data/sig/shikimori/api/v2/abuse_requests.rbs +18 -0
  83. data/sig/shikimori/api/v2/episode_notifications.rbs +25 -0
  84. data/sig/shikimori/api/v2/topic_ignore.rbs +16 -0
  85. data/sig/shikimori/api/v2/user_ignore.rbs +16 -0
  86. data/sig/shikimori/api/v2/user_rates.rbs +43 -0
  87. data/sig/shikimori/api/v2.rbs +16 -0
  88. data/sig/shikimori/api/version.rbs +5 -0
  89. data/sig/shikimori/api.rbs +18 -0
  90. metadata +137 -0
@@ -0,0 +1,148 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Shikimori
4
+ module API
5
+ class V1
6
+ # Methods for the Favorites API
7
+ #
8
+ # @see https://shikimori.one/api/doc/1.0/favorites Shikimori's API documentation
9
+ module Favorites
10
+ # Add object to favorites
11
+ #
12
+ # @param id [#to_s] Favorite's object id
13
+ # @param type ['person', 'anime', 'manga', 'ranobe', 'character'] Favorite's object type
14
+ # @param person_type ['common', 'seyu', 'mangaka', 'producer', 'person'] Person type.
15
+ # Required for :type equal to person
16
+ # @param headers [Hash] Request headers
17
+ # @param query [Hash] Query string parameters for request
18
+ #
19
+ # @return [Bool] True if create a new favorite is successful
20
+ #
21
+ # @see https://shikimori.one/api/doc/1.0/favorites/create Shikimori's API documentation
22
+ # @example Add mangaka with id equal to 1 to favorites
23
+ # client = Shikimori::API::Client.new(
24
+ # app_name: 'Api Test',
25
+ # aceess_token: '****',
26
+ # refresh_token: '****'
27
+ # )
28
+ # client.v1.create_favorite(1, type: 'person', person_type: 'mangaka')
29
+ # @example Add anime with id equal to 1 to favorites
30
+ # client = Shikimori::API::Client.new(
31
+ # app_name: 'Api Test',
32
+ # aceess_token: '****',
33
+ # refresh_token: '****'
34
+ # )
35
+ # client.v1.create_favorite(1, type: 'anime') #=> { success: true, notice: '...' }
36
+ def create_favorite(id, type:, person_type: 'person', headers: nil, **query)
37
+ path = creation_favorite_path_by(type.to_s.downcase, id.to_s, person_type)
38
+ rest.post base_url.join('favorites', *path).url, {}, headers: headers, query: query
39
+
40
+ true
41
+ end
42
+
43
+ # Delete Favorite
44
+ #
45
+ # @param id [String, Integer] Favorite id
46
+ # @param type ['person', 'anime', 'manga', 'ranobe', 'character'] Favorite's object type
47
+ # @param headers [Hash] Request headers
48
+ # @param query [Hash] Query string parameters for request
49
+ #
50
+ # @return [Boolean] True if deletion successful, false otherwise.
51
+ #
52
+ # @see https://shikimori.one/api/doc/1.0/favorites/destroy Shikimori's API documentation
53
+ # @example Delete person with id equal to 1 from favorites
54
+ # client = Shikimori::API::Client.new(
55
+ # app_name: 'Api Test',
56
+ # aceess_token: '****',
57
+ # refresh_token: '****'
58
+ # )
59
+ # client.v1.delete_favorite(1, type: 'person')
60
+ # @example Delete anime with id equal to 1 from favorites
61
+ # client = Shikimori::API::Client.new(
62
+ # app_name: 'Api Test',
63
+ # aceess_token: '****',
64
+ # refresh_token: '****'
65
+ # )
66
+ # client.v1.delete_favorite(1, type: 'anime') #=> true
67
+ def delete_favorite(id, type:, headers: nil, **query)
68
+ path = deletion_favorite_path_by(type.to_s.downcase, id.to_s)
69
+ rest.delete base_url.join('favorites', *path).url, headers: headers, query: query
70
+
71
+ true
72
+ end
73
+
74
+ # Reorder favorite
75
+ #
76
+ # @param id [#to_s] Favorite's id
77
+ # @param position [Integer] New position for favroite. Must be greater or equal than 0
78
+ # @param headers [Hash] Request headers
79
+ # @param query [Hash] Query string parameters for request
80
+ #
81
+ # @return [Bool] True if reordering is successful
82
+ #
83
+ # @see https://shikimori.one/api/doc/1.0/favorites/reorder Shikimori's API documentation
84
+ # @example Reorder favorite with id equal to 1 to 10 position
85
+ # client = Shikimori::API::Client.new(
86
+ # app_name: 'Api Test',
87
+ # aceess_token: '****',
88
+ # refresh_token: '****'
89
+ # )
90
+ # client.v1.reorder_favorite(1, position: 10)
91
+ def reorder_favorite(id, position:, headers: nil, **query)
92
+ rest.post(
93
+ base_url.join('favorites', id.to_s, 'reorder').url,
94
+ { new_index: position },
95
+ headers: headers, query: query
96
+ )
97
+
98
+ true
99
+ end
100
+
101
+ private
102
+
103
+ # Generate path for adding to favorites
104
+ #
105
+ # @param type [String] Type of favorite
106
+ # @param id [String] Favorite's object id
107
+ # @param person_type [String] Person type
108
+ #
109
+ # @return [Array<String>] Array of path to adding object to favorites
110
+ def creation_favorite_path_by(type, id, person_type = 'person')
111
+ case type
112
+ when 'person'
113
+ ['Person', id, person_type]
114
+ when 'manga'
115
+ ['Manga', id]
116
+ when 'ranobe'
117
+ ['Ranobe', id]
118
+ when 'character'
119
+ ['Character', id]
120
+ else
121
+ ['Anime', id]
122
+ end
123
+ end
124
+
125
+ # Generate path for deletion from favorites
126
+ #
127
+ # @param type [String] Type of favorite
128
+ # @param id [String] Favorite's object id
129
+ #
130
+ # @return [Array<String>] Array of path to delete object from favorites
131
+ def deletion_favorite_path_by(type, id)
132
+ case type
133
+ when 'person'
134
+ ['Person', id]
135
+ when 'manga'
136
+ ['Manga', id]
137
+ when 'ranobe'
138
+ ['Ranobe', id]
139
+ when 'character'
140
+ ['Character', id]
141
+ else
142
+ ['Anime', id]
143
+ end
144
+ end
145
+ end
146
+ end
147
+ end
148
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Shikimori
4
+ module API
5
+ class V1
6
+ # Methods for the Forums API
7
+ #
8
+ # @see https://shikimori.one/api/doc/1.0/forums Shikimori's API documentation
9
+ module Forums
10
+ # Get list of Forums
11
+ #
12
+ # @param headers [Hash] Request headers
13
+ # @param query [Hash] Query string parameters for request
14
+ #
15
+ # @return [Array<Hash>] Array of hashes representing forums
16
+ #
17
+ # @see https://shikimori.one/api/doc/1.0/forums/index Shikimori's API documentation
18
+ # @example Get list of forums
19
+ # client = Shikimori::API::Client.new(
20
+ # app_name: 'Api Test',
21
+ # aceess_token: '****',
22
+ # refresh_token: '****'
23
+ # )
24
+ # client.v1.forums #=> [{ id: 1, ... }, ...]
25
+ def forums(headers: nil, **query)
26
+ rest.get base_url.join('forums').url, headers: headers, query: query
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Shikimori
4
+ module API
5
+ class V1
6
+ # Methods for the Friends API
7
+ #
8
+ # @see https://shikimori.one/api/doc/1.0/friends Shikimori's API documentation
9
+ module Friends
10
+ # Create friend by user_id.
11
+ # Requires `friends` oauth scope
12
+ #
13
+ # @param user_id [#to_s] User id that add to friends
14
+ # @param headers [Hash] Request headers
15
+ # @param query [Hash] Query string parameters for request
16
+ #
17
+ # @return [Boolean] True if added to friends
18
+ #
19
+ # @see https://shikimori.one/api/doc/1.0/friends/create Shikimori's API documentation
20
+ # @example Add to friends a user with id equal to 1
21
+ # client = Shikimori::API::Client.new(
22
+ # app_name: 'Api Test',
23
+ # aceess_token: '****',
24
+ # refresh_token: '****'
25
+ # )
26
+ # client.v1.create_friend(1)
27
+ def create_friend(user_id, headers: nil, **query)
28
+ rest.post base_url.join('friends', user_id.to_s).url, {}, headers: headers, query: query
29
+
30
+ true
31
+ end
32
+
33
+ # Delete friend by user id.
34
+ # Requires `friends` oauth scope
35
+ #
36
+ # @param user_id [#to_s] Friend id
37
+ # @param headers [Hash] Request headers
38
+ # @param query [Hash] Query string parameters for request
39
+ #
40
+ # @return [Boolean] True if deletion successful, false otherwise.
41
+ #
42
+ # @see https://shikimori.one/api/doc/1.0/friends/destroy Shikimori's API documentation
43
+ # @example Delete a user from friends by id equal to 1
44
+ # client = Shikimori::API::Client.new(
45
+ # app_name: 'Api Test',
46
+ # aceess_token: '****',
47
+ # refresh_token: '****'
48
+ # )
49
+ #
50
+ # client.v1.delete_friend(1)
51
+ def delete_friend(user_id, headers: nil, **query)
52
+ rest.delete base_url.join('friends', user_id.to_s).url, headers: headers, query: query
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Shikimori
4
+ module API
5
+ class V1
6
+ # Methods for the Genres API
7
+ #
8
+ # @see https://shikimori.one/api/doc/1.0/genres Shikimori's API documentation
9
+ module Genres
10
+ # Get list of genres
11
+ #
12
+ # @param headers [Hash] Request headers
13
+ # @param query [Hash] Query string parameters for request
14
+ #
15
+ # @return [Array<Hash>] Array of hashes representing genres
16
+ #
17
+ # @see https://shikimori.one/api/doc/1.0/genres/index Shikimori's API documentation
18
+ # @example Get list of genres
19
+ # client = Shikimori::API::Client.new(
20
+ # app_name: 'Api Test',
21
+ # aceess_token: '****',
22
+ # refresh_token: '****'
23
+ # )
24
+ # client.v1.genres #=> [{ id: 1, ... }, ...]
25
+ def genres(headers: nil, **query)
26
+ rest.get base_url.join('genres').url, headers: headers, query: query
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Shikimori
4
+ module API
5
+ class V1
6
+ # Methods for the Ignores API
7
+ #
8
+ # @deprecated Use {Shikimori::API::V2::UserIgnore} instead
9
+ #
10
+ # @see https://shikimori.one/api/doc/1.0/ignores Shikimori's API documentation
11
+ module Ignores
12
+ # Add user to ignore by user id.
13
+ # Requires `ignores` oauth scope
14
+ #
15
+ # @param user_id [#to_s] User id that add to ignores
16
+ # @param headers [Hash] Request headers
17
+ # @param query [Hash] Query string parameters for request
18
+ #
19
+ # @return [Hash] Hash representing created user ignore
20
+ #
21
+ # @see https://shikimori.one/api/doc/1.0/ignores/create Shikimori's API documentation
22
+ # @example Add to ignore a user with id equal to 1
23
+ # client = Shikimori::API::Client.new(
24
+ # app_name: 'Api Test',
25
+ # aceess_token: '****',
26
+ # refresh_token: '****'
27
+ # )
28
+ # client.v1.create_ignore(1)
29
+ #
30
+ # @deprecated Use {Shikimori::API::V2::UserIgnore#create_user_ignore} instead
31
+ def create_ignore(user_id, headers: nil, **query)
32
+ rest.post base_url.join('ignores', user_id.to_s).url, {}, headers: headers, query: query
33
+
34
+ true
35
+ end
36
+
37
+ # Delete a user from ignores by user id.
38
+ # Requires `ignores` oauth scope
39
+ #
40
+ # @param user_id [#to_s] User id that remove from ignores
41
+ # @param headers [Hash] Request headers
42
+ # @param query [Hash] Query string parameters for request
43
+ #
44
+ # @return [Boolean] True if deletion successful, false otherwise.
45
+ #
46
+ # @see https://shikimori.one/api/doc/1.0/ignores/destroy Shikimori's API documentation
47
+ # @example Delete a ignore
48
+ # client = Shikimori::API::Client.new(
49
+ # app_name: 'Api Test',
50
+ # aceess_token: '****',
51
+ # refresh_token: '****'
52
+ # )
53
+ # client.v1.delete_ignore(1)
54
+ #
55
+ # @deprecated Use {Shikimori::API::V2::UserIgnore#delete_user_ignore} instead
56
+ def delete_ignore(user_id, headers: nil, **query)
57
+ rest.delete base_url.join('ignores', user_id.to_s).url, headers: headers, query: query
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,211 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Shikimori
4
+ module API
5
+ class V1
6
+ # Methods for the Mangas API
7
+ #
8
+ # @see https://shikimori.one/api/doc/1.0/mangas Shikimori's API documentation
9
+ module Mangas
10
+ # Get list of manga titles
11
+ #
12
+ # @param headers [Hash] Request headers
13
+ # @param query [Hash] Filters and pagination for mangas
14
+ # @option query [Integer] :page Number of page. Must be between 1 and 100000
15
+ # @option query [Integer] :limit Number of titles per page. Must be a lower or equal that 50
16
+ # @option query ["id", "id_desc", "ranked", "chapters",
17
+ # "kind", "popularity", "name",
18
+ # "aired_on", "volumes", "status",
19
+ # "random", "ranked_random",
20
+ # "ranked_shiki", "created_at", "created_at_desc"] :order Sorting type.
21
+ # @option query [String, Symbol] :type Type of title. Deprecated! use :kind instead
22
+ # @option query ["manga", "manhwa", "manhua",
23
+ # "light_novel", "novel",
24
+ # "one_shot", "doujin"] :kind Type of manga title
25
+ # @option query ["anons", "ongoing", "released", "paused", "discontinued"] :status Manga title status
26
+ # @option query [String] :season Manga season. Examples: "summer_2017", "2016", "2014_2016", "199x"
27
+ # @option query [Integer] :score Minimal manga score
28
+ # @option query [String] :genre List of genre ids separated by comma
29
+ # @option query [String] :genre_v2 List of genre v2 ids separated by comma
30
+ # @option query [String] :publisher List of publisher ids separated by comma
31
+ # @option query [String] :franchise List of franchises separated by comma
32
+ # @option query [TrueClass, FalseClass] :censored Set to false to allow hentai, yaoi and yuri
33
+ # @option query ["planned", "watching", "rewatching",
34
+ # "completed", "on_hold", "dropped"] :mylist Status of anime in current user list
35
+ # @option query [String] :ids List of anime ids separated by comma
36
+ # @option query [String] :exclude_ids List of anime ids separated by comma
37
+ # @option query [String] :search Search phrase to filter mangas by name
38
+ #
39
+ # @return [Array<Hash>] Array of hashes representing mangas
40
+ #
41
+ # @see https://shikimori.one/api/doc/1.0/mangas/index Shikimori's API documentation
42
+ # @example Get 20 manga titles on second page
43
+ # client = Shikimori::API::Client.new(
44
+ # app_name: 'Api Test',
45
+ # aceess_token: '****',
46
+ # refresh_token: '****'
47
+ # )
48
+ # client.v1.mangas(page: 2, limit: 20) #=> [{ id: 1, ... }, { id: 2, ... }, ...]
49
+ # @example Get top 50 ongoing manga titles
50
+ # client = Shikimori::API::Client.new(
51
+ # app_name: 'Api Test',
52
+ # aceess_token: '****',
53
+ # refresh_token: '****'
54
+ # )
55
+ # client.v1.mangas(limit: 50, status: 'ongoing', order: 'ranked') #=> [{ id: 1, ... }, { id: 2, ... }, ...]
56
+ # @example Get 10 random manga titles released in the 90s
57
+ # client = Shikimori::API::Client.new(
58
+ # app_name: 'Api Test',
59
+ # aceess_token: '****',
60
+ # refresh_token: '****'
61
+ # )
62
+ # client.v1.mangas(limit: 10, order: 'random', season: '199x') #=> [{ id: 1, ... }, { id: 2, ... }, ...]
63
+ def mangas(headers: nil, **query)
64
+ rest.get base_url.join('mangas').url, headers: headers, query: query
65
+ end
66
+
67
+ # Get an manga by id
68
+ #
69
+ # @param id [#to_s] Manga id
70
+ # @param headers [Hash] Request headers
71
+ # @param query [Hash] Query string parameters for request
72
+ #
73
+ # @return [Hash] Hash representing Manga
74
+ #
75
+ # @see https://shikimori.one/api/doc/1.0/mangas/show Shikimori's API documentation
76
+ # @example Get manga with id equal to 1
77
+ # client = Shikimori::API::Client.new(
78
+ # app_name: 'Api Test',
79
+ # aceess_token: '****',
80
+ # refresh_token: '****'
81
+ # )
82
+ # client.v1.manga(1) #=> { id: 1, ... }
83
+ def manga(id, headers: nil, **query)
84
+ rest.get base_url.join('mangas', id.to_s).url, headers: headers, query: query
85
+ end
86
+
87
+ # Get an manga roles
88
+ #
89
+ # @param id [#to_s] manga id
90
+ # @param headers [Hash] Request headers
91
+ # @param query [Hash] Query string parameters for request
92
+ #
93
+ # @return [Hash] Hash representing manga roles
94
+ #
95
+ # @see https://shikimori.one/api/doc/1.0/mangas/roles Shikimori's API documentation
96
+ # @example Get a first manga roles
97
+ # client = Shikimori::API::Client.new(
98
+ # app_name: 'Api Test',
99
+ # aceess_token: '****',
100
+ # refresh_token: '****'
101
+ # )
102
+ # client.v1.manga_roles(1) #=> { roles: [...], roles_russian: [...], character: {...}, person: {...} }
103
+ def manga_roles(id, headers: nil, **query)
104
+ rest.get base_url.join('mangas', id.to_s, 'roles').url, headers: headers, query: query
105
+ end
106
+
107
+ # Get an manga similar
108
+ #
109
+ # @param id [#to_s] Manga id
110
+ # @param headers [Hash] Request headers
111
+ # @param query [Hash] Query string parameters for request
112
+ #
113
+ # @return [Array<Hash>] Array of hashes representing similar mangas
114
+ #
115
+ # @see https://shikimori.one/api/doc/1.0/mangas/similar Shikimori's API documentation
116
+ # @example Get a similar manga titles for manga with id equal to 1
117
+ # client = Shikimori::API::Client.new(
118
+ # app_name: 'Api Test',
119
+ # aceess_token: '****',
120
+ # refresh_token: '****'
121
+ # )
122
+ # client.v1.manga_similar(1) #=> { id: 2, ... }
123
+ def manga_similar(id, headers: nil, **query)
124
+ rest.get base_url.join('mangas', id.to_s, 'similar').url, headers: headers, query: query
125
+ end
126
+
127
+ # Get an related mangas
128
+ #
129
+ # @param id [#to_s] Manga id
130
+ # @param headers [Hash] Request headers
131
+ # @param query [Hash] Query string parameters for request
132
+ #
133
+ # @return [Array<Hash>] Array of hashes representing related mangas
134
+ #
135
+ # @see https://shikimori.one/api/doc/1.0/mangas/related Shikimori's API documentation
136
+ # @example Get a related anime, manga and ranobe titles for anime with id equal to 1
137
+ # client = Shikimori::API::Client.new(
138
+ # app_name: 'Api Test',
139
+ # aceess_token: '****',
140
+ # refresh_token: '****'
141
+ # )
142
+ # client.v1.manga_related(1)
143
+ # #=> [{ relation: "...", relation_russian: "...", anime: { id: 3, ... }, manga: { id: 1, ... } }]
144
+ def manga_related(id, headers: nil, **query)
145
+ rest.get base_url.join('mangas', id.to_s, 'related').url, headers: headers, query: query
146
+ end
147
+
148
+ # Get an manga franchise
149
+ #
150
+ # @param id [#to_s] Manga id
151
+ # @param headers [Hash] Request headers
152
+ # @param query [Hash] Query string parameters for request
153
+ #
154
+ # @return [Hash] Hash representing of manga's franchise tree
155
+ #
156
+ # @see https://shikimori.one/api/doc/1.0/mangas/franchise Shikimori's API documentation
157
+ # @example Get manga franchise tree for manga with id equal to 1
158
+ # client = Shikimori::API::Client.new(
159
+ # app_name: 'Api Test',
160
+ # aceess_token: '****',
161
+ # refresh_token: '****'
162
+ # )
163
+ # client.v1.manga_franchise(1) #=> { links: [{ id: 1, ... }], nodes: [{ id: 1, ... }], current_id: 1 }
164
+ def manga_franchise(id, headers: nil, **query)
165
+ rest.get base_url.join('mangas', id.to_s, 'franchise').url, headers: headers, query: query
166
+ end
167
+
168
+ # Get an manga external links
169
+ #
170
+ # @param id [#to_s] Manga id
171
+ # @param headers [Hash] Request headers
172
+ # @param query [Hash] Query string parameters for request
173
+ #
174
+ # @return [Array<Hash>] Array of hashes representing manga's extenal links
175
+ #
176
+ # @see https://shikimori.one/api/doc/1.0/mangas/external_links Shikimori's API documentation
177
+ # @example Get related external links for manga with id equal 1
178
+ # client = Shikimori::API::Client.new(
179
+ # app_name: 'Api Test',
180
+ # aceess_token: '****',
181
+ # refresh_token: '****'
182
+ # )
183
+ # client.v1.manga_external_links(1) #=> [{ id: 1, ... }, { id: nil, ... }]
184
+ def manga_external_links(id, headers: nil, **query)
185
+ rest.get base_url.join('mangas', id.to_s, 'external_links').url, headers: headers, query: query
186
+ end
187
+
188
+ # Get an manga topics
189
+ #
190
+ # @param id [#to_s] Manga id
191
+ # @param headers [Hash] Request headers
192
+ # @param query [Hash] Query string parameters for request
193
+ # @option query [Integer] :page Number of page. Must be between 1 and 100000
194
+ # @option query [Integer] :limit Number of titles per page. Must be a lower or equal that 50
195
+ # @return [Array<Hash>] Array of hashes representing manga's topics
196
+ #
197
+ # @see https://shikimori.one/api/doc/1.0/mangas/topics Shikimori's API documentation
198
+ # @example Get topics for manga with id equal 1
199
+ # client = Shikimori::API::Client.new(
200
+ # app_name: 'Api Test',
201
+ # aceess_token: '****',
202
+ # refresh_token: '****'
203
+ # )
204
+ # client.v1.manga_topics(1) #=> [{ id: 1, ... }]
205
+ def manga_topics(id, headers: nil, **query)
206
+ rest.get base_url.join('mangas', id.to_s, 'topics').url, headers: headers, query: query
207
+ end
208
+ end
209
+ end
210
+ end
211
+ end