rust_anilist/models/studio.rs
1// SPDX-License-Identifier: MIT
2// Copyright (c) 2022-2025 Andriel Ferreira <https://github.com/AndrielFR>
3
4//! This module contains the `Studio` struct.
5
6use serde::{Deserialize, Serialize};
7
8use crate::Result;
9
10/// Represents a studio with various attributes.
11///
12/// The `Studio` struct contains detailed information about a studio,
13/// including its ID, name, whether it is an animation studio, URL,
14/// whether it is a favorite, and the number of favorites.
15///
16/// # Fields
17///
18/// * `id` - The ID of the studio.
19/// * `name` - The name of the studio.
20/// * `is_animation_studio` - Whether the studio is an animation studio.
21/// * `url` - The URL of the studio.
22/// * `is_favourite` - An optional boolean indicating if the studio is a favorite.
23/// * `favourites` - The number of favorites the studio has.
24#[derive(Debug, Default, Clone, PartialEq, Deserialize, Serialize)]
25#[serde(rename_all(deserialize = "camelCase"))]
26pub struct Studio {
27 /// The ID of the studio.
28 pub id: i64,
29 /// The name of the studio.
30 pub name: String,
31 /// Whether the studio is an animation studio.
32 pub is_animation_studio: bool,
33 /// The URL of the studio.
34 pub url: String,
35 /// Whether the studio is a favorite.
36 pub is_favourite: Option<bool>,
37 /// The number of favorites the studio has.
38 pub favourites: i64,
39}
40
41impl Studio {
42 /// Retrieves media associated with the studio.
43 ///
44 /// This function fetches media related to the studio and returns a
45 /// result containing the media data of type `T`.
46 ///
47 /// # Type Parameters
48 ///
49 /// * `T` - The type of the media to be returned.
50 ///
51 /// # Example
52 ///
53 /// ```no_run
54 /// # use rust_anilist::{models::{Anime, Studio}, Result};
55 /// #
56 /// # async fn f(studio: Studio) -> Result<()> {
57 /// let animes = studio.get_medias::<Anime>().await?;
58 /// # Ok(())
59 /// # }
60 /// ```
61 pub async fn get_medias<T>(&self) -> Result<Vec<T>> {
62 unimplemented!()
63 }
64}