dart_royale 1.2.5

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

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 pub get

Alternatively, your editor might support pub get or flutter pub 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]
0
Health:
Code health derived from static analysis. [more]
93
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
48
Learn more about scoring.

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

  • Dart: 2.3.2
  • pana: 0.12.18

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 have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/structures/clan.dart. (-2.96 points)

Analysis of lib/structures/clan.dart reported 6 hints, including:

line 6 col 15: Use = to separate a named parameter from its default value.

line 6 col 24: Use = to separate a named parameter from its default value.

line 6 col 37: Use = to separate a named parameter from its default value.

line 6 col 50: Use = to separate a named parameter from its default value.

line 6 col 64: Use = to separate a named parameter from its default value.

Fix lib/structures/tournament.dart. (-2.48 points)

Analysis of lib/structures/tournament.dart reported 5 hints:

line 10 col 26: Use = to separate a named parameter from its default value.

line 10 col 33: Use = to separate a named parameter from its default value.

line 10 col 40: Use = to separate a named parameter from its default value.

line 10 col 54: Use = to separate a named parameter from its default value.

line 10 col 65: Use = to separate a named parameter from its default value.

Fix lib/structures/player.dart. (-0.50 points)

Analysis of lib/structures/player.dart reported 1 hint:

line 15 col 10: DO use curly braces for all flow control structures.

Fix additional 4 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/Royale.dart (Run dartfmt to format lib/Royale.dart.)
  • 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.)

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+2
Transitive dependencies
async 2.2.0
charcode 1.1.2
collection 1.14.11
http_parser 3.1.3
meta 1.1.7
path 1.6.2
pedantic 1.7.0
source_span 1.5.5
string_scanner 1.0.4
term_glyph 1.1.0
typed_data 1.1.6