### KodikData Constructor and Methods - Dart Source: https://pub.dev/documentation/libanime/latest/structures_kodik_kodik_player_data/KodikData-class Demonstrates the instantiation of the KodikData class using its default constructor and provides examples for its key methods. ```dart final kodikData = KodikData(); // Example of using the get method final dataMap = kodikData.get({'key': 'value'}); print(dataMap); // toString() method example print(kodikData.toString()); ``` -------------------------------- ### Extract Video Details using Regex in Dart Source: https://pub.dev/documentation/libanime/latest/structures_kodik_kodik_player_data/KodikData/get This Dart function, `get`, takes a dynamic data string as input and extracts video-related information including type, hash, and ID using regular expressions. It returns a Map containing these extracted details along with default values for 'bad_user', 'info', and 'cdn_is_working'. ```dart Map get(data) { //print(data); // ignore: unnecessary_string_escapes //const regex = r"var(?:\s*)urlParams(?:\s*)=(?:\s*)['\"](\{.*\})['\"]\;?"; //RegExpMatch? domain = RegExp(regex).firstMatch(data); String? type = RegExp(r"videoInfo.type = '(.*?)';").firstMatch(data)![1]; String? hash = RegExp(r"videoInfo.hash = '(.*?)';").firstMatch(data)![1]; String? id = RegExp(r"videoInfo.id = '(.*?)';").firstMatch(data)![1]; return { //"domain": domain, "type": type, "hash": hash, "id": id, "bad_user": "True", "info": "{}", "cdn_is_working": "True" }; } ``` -------------------------------- ### Get Short Manga Info by Slug (Dart) Source: https://pub.dev/documentation/libanime/latest/wrappers_manga_mangalib/LibMe/getShortInfoBySlug This Dart method, `getShortInfoBySlug`, takes a manga slug as input and makes an HTTP GET request to retrieve short information about the manga. It handles potential `DioException` errors, specifically distinguishing between a bad slug (400 status code) and other general errors. ```dart Future getShortInfoBySlug(String slug) async { try { final response = await _dio.get('/manga-short-info?slug=$slug'); return response.data; } on DioException catch (e) { if (e.response!.statusCode == 400) { throw Exception("Bad slug! Media not found!"); } else { throw Exception("An error has occurred"); } } } ``` -------------------------------- ### Dart Whoami API Call Source: https://pub.dev/documentation/libanime/latest/wrappers_anime_shikimori_oauth/ShikimoriOAuth/whoami Implements the whoami method to fetch user data from the API. It makes a GET request to the /api/users/whoami endpoint using Dio, including necessary headers like User-Agent and Authorization. Error handling for DioException is included, throwing a BadResponseException on failure. ```dart Future?>? whoami() async { try { final res = await _dio.get("https://$_domain/api/users/whoami", options: Options(headers: { 'User-Agent': applicationName, 'Authorization': "Bearer $accessToken" })); return res.data; } on DioException { //print(e.response!.data); throw BadResponseException(); } } ``` -------------------------------- ### Fetch Anime Skip Timings with Dart (Dio) Source: https://pub.dev/documentation/libanime/latest/wrappers_skips_aniskip/AniSkip/getTimings This Dart implementation uses the Dio library to make an HTTP GET request to the Aniskip API to retrieve skip timings for a given anime episode. It handles potential DioExceptions, differentiating between 'not found' errors and general bad response errors. It requires the 'dio' package. ```dart Future>? getTimings( int malId, int episode, double episodeDuration) async { try { final response = await Dio().get( "https://api.aniskip.com/v2/skip-times/$malId/$episode?types[]=ed&types[]=mixed-ed&types[]=mixed-op&types[]=op&types[]=recap&episodeLength=$episodeDuration"); return response.data["results"]; } on DioException catch (e) { if (!e.response!.data["found"]) { throw NotFoundException( "Not found. May be you're provided bad malId, episode or episodeDuration."); } else { throw BadResponseException("An error has occurred"); } } } ``` -------------------------------- ### Get API Access Token (Dart) Source: https://pub.dev/documentation/libanime/latest/wrappers_anime_shikimori_oauth/ShikimoriOAuth/getAccessToken This Dart method retrieves an API access token by sending an authorization code, client ID, client secret, and redirect URI to the libanime OAuth token endpoint. It handles potential network errors and returns the token data or throws specific exceptions. ```Dart Future?> getAccessToken(String code) async { // Map? try { final requestData = { 'grant_type': 'authorization_code', 'client_id': clientId, 'client_secret': clientSecret, 'code': code, 'redirect_uri': redirectUrl }; final res = await _dio.post("https://$_domain/oauth/token", data: requestData, options: Options(headers: {'User-Agent': applicationName})); accessToken = res.data["access_token"]; refreshToken = res.data["refresh_token"]; return res.data; } on DioException catch (e) { //print(e.response!.data); if (e.response!.statusCode == 404) { throw NotFoundException(); } else { throw BadResponseException(); } } } ``` -------------------------------- ### Anime365 Class - Initialization Source: https://pub.dev/documentation/libanime/latest/wrappers_anime_anime365_anime365/Anime365-class Information on how to create a new instance of the Anime365 class. ```APIDOC ## Anime365.new ### Description Creates a new instance of the Anime365 class. An optional access token can be provided during initialization. ### Method Constructor ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "accessToken": "your_access_token" } ``` ### Response #### Success Response (Instance) - **Anime365** (object) - An instance of the Anime365 class. #### Response Example (Instance creation does not return a JSON response, but rather an object instance.) ``` -------------------------------- ### Kodik Constructors and Properties Source: https://pub.dev/documentation/libanime/latest/parsers_anime_kodik_kodik/Kodik-class Details on how to instantiate the Kodik class and its available properties. ```APIDOC ## Kodik Class Details ### Description Provides information about the Kodik class, including its constructors, properties, methods, and operators. ### Constructors #### `Kodik.new([String? token])` - **token** (String?) - Optional - An authentication token for the service. ### Properties #### `hashCode` → int - **Description**: The hash code for this object. (inherited) #### `runtimeType` → Type - **Description**: A representation of the runtime type of the object. (inherited) #### `token` ↔ String? - **Description**: Getter/setter pair for the token property. ``` -------------------------------- ### Sibnet Class Methods Source: https://pub.dev/documentation/libanime/latest/parsers_anime_sibnet_sibnet/Sibnet-class Provides documentation for the methods available in the Sibnet class. These include retrieving a service, handling non-existent method calls, parsing video links, and generating a string representation of the object. ```dart getService() → Service noSuchMethod(Invocation invocation) → dynamic parse(String link) → Future