dart_royale 1.2.5

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new53

dartRoyale

An easy way to get data from the royale API.
Documentation is available at https://docs.royaleapi.com/
PUB: https://pub.dartlang.org/packages/dart_royale

Usage

dartRoyale comes with 5 routes you can use: Top, Clan, Player, Popular, Tournament
To acess a route, you can use: Royale(apiKey).route()

You can get a key Here

import "package:dart_royale/Royale.dart";
var royale = Royale(apiKey);

Player Router

// get a player
var Players = royale.Player();
var player = await Players.get("8L9L9GL");
//  you can pass an array of tags instead, and recieve array of responses
var players = await Players.get(["LCQPVYVR","LCQPVYVR"]);
print(player.player); // this return basic player information
//if you have an array you can do:
print(player[0].player);
// You can get more information about player using fetch() function, it will returns Player battles, and Player Chests
var playerinfo =  await player.fetch();
var playersinfo = await players[0].fetch();

Clan Router

// get a clan
var Clans = royale.Clan();
var clan = await Clans.get("9PJ82CRC");
print (clan.clan); //this return clan information and like player you can do:
var clans = await Clans.get(["9PJ82CRC","9PJ82CRC"]);
print(clan[0].clan);
var claninfo = clan.fetch();
var clansearch = await Clans.search(name:"back2future");
// params to search  name:"",score:0,minMembers:0,maxMembers:50,locationId:0
// you can get locationId in https://github.com/RoyaleAPI/cr-api-data/blob/master/json/regions.json
// you will get an array of clans, to get more info about the clan, like members you will ned to get him using tag returned
// to get war information, week information, battles information and history information you will need to use .fetch() function example:
var clan2 = await Clans.get(clansearch[0]['tag']);
var clan2info = await clan2.fetch();

Top Router

//Get tops
var Tops = royale.Top();
var clantop = await Tops.get("clans");
var playerstop = await Tops.get("players");
var wartop = await Tops.get("war");
// you can get top of a region by they location_key you can get this in https://github.com/RoyaleAPI/cr-api-data/blob/master/json/regions.json, example:
var usclantop = await Tops.get("clans","us");

Popular Router

//get Populars
var Populars = royale.Popular();
var popularClans = await Populars.get("clans");
var popularPlayers = await Populars.get("players");
var popularTournaments = await Populars.get("tournaments");
var popularDecks = await Populars.get("decks");

Tournament Router

//get tournament
var Tournaments = royale.Tournament();
var tourney = await Tournaments.get("tag");
// like clans, and players accepts an array of tags
// search tournament {joinable:0,open:0,full:0,preparation:0,thousand:0}
// 0 for inactive filter, 1 for active filter
// the filter bellow will get all tournaments that you can join, is in preparation time and is a 1000 players tournament
var tourneys = await Tournaments.search(joinable:1,open:1,full:0,preparation:1,thousand:1);

You can found more examples in Here

  • 1.2.0 - Update readme

example/Main.dart

import "package:dart_royale/Royale.dart";
import 'dart:async';
// get a player
var key = "api key here";
Future main() async{
var royale = Royale(key);
var Players = royale.Player();
var player = await Players.get("8L9L9GL");
//  you can pass an array of tags instead, and recieve array of responses
var players = await Players.get(["LCQPVYVR","LCQPVYVR"]);
// You can get more information about player using fetch() function, it will returns Player battles, and Player Chests
var playerinfo =  await player.fetch();
var playersinfo = await players[0].fetch();

// get a clan
var Clans = royale.Clan();
var clan = await Clans.get("9PJ82CRC");
var claninfo = clan.fetch();
//like Player you can pass an array of tags too
var clansearch = await Clans.search(name:"back2future");
// params to search  name:"",score:0,minMembers:0,maxMembers:50,locationId:''
// you can get locationId in https://github.com/RoyaleAPI/cr-api-data/blob/master/json/regions.json
// you will get an array of clans, to get more info about the clan, like members you will ned to get him using tag returned
// to get war information, week information, battles information and history information you will need to use .fetch() function example:
var clan2 = await Clans.get(clansearch[0]['tag']);
var clan2info = await clan2.fetch();

//Get tops
var Tops = royale.Top();
var clantop = await Tops.get("clans");
var playerstop = await Tops.get("players");
var wartop = await Tops.get("war");
// you can get top of a region by they location_key you can get this in https://github.com/RoyaleAPI/cr-api-data/blob/master/json/regions.json example
var usclantop = await Tops.get("clans","us");

//get Populars
var Populars = royale.Popular();
var popularClans = await Populars.get("clans");
var popularPlayers = await Populars.get("players");
var popularTournaments = await Populars.get("tournaments");
var popularDecks = await Populars.get("decks");

//get tournament
var Tournaments = royale.Tournament();
var tourney = await Tournaments.get("tag");
// like clans, and players accepts an array of tags
// search tournament {joinable:0,open:0,full:0,preparation:0,thousand:0}
// 0 for inactive filter, 1 for active filter
// the filter bellow will get all tournaments that you can join, is in preparation time and is a 1000 players tournament
var tourneys = await Tournaments.search(joinable:1,open:1,full:0,preparation:1,thousand:1);
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  dart_royale: ^1.2.5

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:dart_royale/Royale.dart';
import 'package:dart_royale/structures/clan.dart';
import 'package:dart_royale/structures/player.dart';
import 'package:dart_royale/structures/popular.dart';
import 'package:dart_royale/structures/request.dart';
import 'package:dart_royale/structures/top.dart';
import 'package:dart_royale/structures/tournament.dart';
  
Version Uploaded Documentation Archive
1.2.5 Dec 28, 2018 Go to the documentation of dart_royale 1.2.5 Download dart_royale 1.2.5 archive
1.2.4 Dec 28, 2018 Go to the documentation of dart_royale 1.2.4 Download dart_royale 1.2.4 archive
1.2.3 Dec 28, 2018 Go to the documentation of dart_royale 1.2.3 Download dart_royale 1.2.3 archive
1.2.2 Dec 28, 2018 Go to the documentation of dart_royale 1.2.2 Download dart_royale 1.2.2 archive
1.2.1 Dec 28, 2018 Go to the documentation of dart_royale 1.2.1 Download dart_royale 1.2.1 archive
1.2.0 Dec 28, 2018 Go to the documentation of dart_royale 1.2.0 Download dart_royale 1.2.0 archive
1.1.0 Dec 28, 2018 Go to the documentation of dart_royale 1.1.0 Download dart_royale 1.1.0 archive
1.0.0 Dec 27, 2018 Go to the documentation of dart_royale 1.0.0 Download dart_royale 1.0.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
6
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
53
Learn more about scoring.

We analyzed this package on Jan 15, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.10

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in libraries.

Health issues and suggestions

Document public APIs. (-1 points)

59 out of 59 API elements (library, class, field or method) have no adequate dartdoc content. Good documentation improves code readability and discoverability through search.

Format lib/Royale.dart.

Run dartfmt to format lib/Royale.dart.

Format lib/structures/clan.dart.

Run dartfmt to format lib/structures/clan.dart.

Format lib/structures/player.dart.

Run dartfmt to format lib/structures/player.dart.

Fix additional 4 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/structures/popular.dart (Run dartfmt to format lib/structures/popular.dart.)
  • lib/structures/request.dart (Run dartfmt to format lib/structures/request.dart.)
  • lib/structures/top.dart (Run dartfmt to format lib/structures/top.dart.)
  • lib/structures/tournament.dart (Run dartfmt to format lib/structures/tournament.dart.)

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.63.0 <3.0.0
http ^0.12.0 0.12.0+1
Transitive dependencies
async 2.0.8
charcode 1.1.2
collection 1.14.11
http_parser 3.1.3
meta 1.1.7
path 1.6.2
source_span 1.5.1
string_scanner 1.0.4
term_glyph 1.1.0
typed_data 1.1.6