hnpwa_client 1.0.0

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

HNPWA Dart Client

Build Status codecov

Fetch data from the HNPWA api! This is an alternative to the official Hacker News API that is built for Progressive Web app and Mobile usage!

No API key needed. Just create a client and fetch data!

Usage

A simple usage example:

import 'package:hnpwa_client/hnpwa_client.dart';

main() async {
  final client = new HnpwaClient();

  // Print the top stories
  print(await client.news());

  // Print the 4th page of newest stories
  print(await client.newest(page: 4));

  // Access a specific item
  print(await client.item(4));

  // Query a specific user
  print(await client.user('davideast'));
}

Features and bugs

Please file feature requests and bugs at the issue tracker.

1.0.0

  • Initial version -- provides ability to fetch feeds by page, items, and users from the HNPWA API
  • Fetch data with HnpwaClient class
  • Provides the following models:
    • Feed
    • FeedItem
    • Item
    • User

example/hnpwa_client_example.dart

import 'package:hnpwa_client/hnpwa_client.dart';

main() async {
  final client = new HnpwaClient();

  // Print the top stories
  print(await client.news());

  // Print the 4th page of newest stories
  print(await client.newest(page: 4));

  // Access a specific item
  print(await client.item(4));

  // Query a specific user
  print(await client.user('davideast'));
}

Use this package as a library

1. Depend on it

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


dependencies:
  hnpwa_client: ^1.0.0

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:hnpwa_client/hnpwa_client.dart';
  
Version Uploaded Documentation Archive
1.0.0 Sep 25, 2018 Go to the documentation of hnpwa_client 1.0.0 Download hnpwa_client 1.0.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
27
Health:
Code health derived from static analysis. [more]
91
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
61
Learn more about scoring.

We analyzed this package on Dec 5, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.7

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:hnpwa_client/hnpwa_client.dart.

Health issues and suggestions

Document public APIs (-9.31 points)

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

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
http ^0.11.3+17 0.11.3+17 0.12.0
Transitive dependencies
async 2.0.8
charcode 1.1.2
collection 1.14.11
http_parser 3.1.3
meta 1.1.6
path 1.6.2
source_span 1.4.1
string_scanner 1.0.4
typed_data 1.1.6
Dev dependencies
test ^1.3.0