pocket_client 0.1.2

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

Pub Package Build Status Coverage Status Github Issues

pocket_client

A library for authenticating and accessing the Pocket API from Dart

Quick start

Authentication:
import 'package:pocket_client/pocket_client.dart';

const consumerKey = '1234-abcd1234abcd1234abcd1234';
const redirectUrl = 'http://some.redirect.uri/autorizationFinished';

main() async {
  var authentication = new ClientAuthentication(consumerKey);

  var requestToken = await authentication.getRequestToken(redirectUrl);
  var url = ClientAuthentication.getAuthorizeUrl(requestToken, redirectUrl);
  // work whatever redirect magic you need here

  //..

  var userData = await authentication.getAccessToken(requestToken);
  onAuthorizationFinished(userData.accessToken);
} 

onAuthorizationFinished(String accessToken) {
  // now you have everything to communicate with Pocket 
}
Working with Pocket:
import 'package:pocket_client/pocket_client.dart';

const consumerKey = '1234-abcd1234abcd1234abcd1234';
const accessToken = '5678defg-5678-defg-5678-defg56';

main() async {
  var client = new Client(consumerKey, accessToken);

  var options = new RetrieveOptions()
    ..since = new DateTime(2015, 5, 4)
    ..search = 'Some search query'
    ..domain = 'http://domain.test'
    ..contentType = ContentType.video
    ..detailType = DetailType.complete
    ..isFavorite = true
    ..sortType = SortType.site
    ..state = State.all
    ..tag = 'cats'
    ..count = 100
    ..offset = 10;

  var response = await client.getData(options: options);
  Map<String, PocketData> items = response.items;
  // do whatever you want with pocket items

  var newItem = new ItemToAdd('http://www.funnycatpix.com/')
    ..title = 'FUNNY CAT PICTURES'
    ..tweetId = '123456'
    ..tags = ['cats', 'cool', 'share'];

  PocketData data = await client.addItem(newItem);
  // do whatever you want with received data
}

Api

See the Api documentation.

Examples

The basic example is in example file

Features and bugs

Please fill feature requests and bugs at the issue tracker.

License

pocket_client is distributed under the BSD license.

Changelog

0.1.2

  • Enabled strong mode and linting, fixed related problems

0.1.1

  • Fixed typo in documentation

0.1.0

  • Initial version, created by Ne4istb

example/pocket_client.dart

// Copyright (c) 2015, Ne4istb. All rights reserved. Use of this source code

// is governed by a BSD-style license that can be found in the LICENSE file.

library pocket_client.example;

import 'package:pocket_client/pocket_client.dart';

const consumerKey = '1234-abcd1234abcd1234abcd1234';
const redirectUrl = 'http://some.redirect.uri/autorizationFinished';
const accessToken = '5678defg-5678-defg-5678-defg56';

main() async {
  var authentication = new ClientAuthentication(consumerKey);

  var requestToken = await authentication.getRequestToken(redirectUrl);
  var url = ClientAuthentication.getAuthorizeUrl(requestToken, redirectUrl);
  // work whatever redirect magic you need here

  //..

  var userData = await authentication.getAccessToken(requestToken);
  onAuthorizationFinished(userData.accessToken);
}

onAuthorizationFinished(String accessToken) async {
  var client = new Client(consumerKey, accessToken);

  var options = new RetrieveOptions()
    ..since = new DateTime(2015, 5, 4)
    ..search = 'Some search query'
    ..domain = 'http://domain.test'
    ..contentType = ContentType.video
    ..detailType = DetailType.complete
    ..isFavorite = true
    ..sortType = SortType.site
    ..state = State.all
    ..tag = 'cats'
    ..count = 100
    ..offset = 10;

  var response = await client.getData(options: options);
  Map<String, PocketData> items = response.items;
  // do whatever you want with pocket items

  var newItem = new ItemToAdd('http://www.funnycatpix.com/')
    ..title = 'FUNNY CAT PICTURES'
    ..tweetId = '123456'
    ..tags = ['cats', 'cool', 'share'];

  PocketData data = await client.addItem(newItem);
  // do whatever you want with received data
}

1. Depend on it

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


dependencies:
  pocket_client: "^0.1.2"

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 packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:pocket_client/pocket_client.dart';
        
Version Uploaded Documentation Archive
0.1.2 Jan 15, 2017 Go to the documentation of pocket_client 0.1.2 Download pocket_client 0.1.2 archive
0.1.1 Oct 5, 2015 Go to the documentation of pocket_client 0.1.1 Download pocket_client 0.1.1 archive
0.1.0 Oct 5, 2015 Go to the documentation of pocket_client 0.1.0 Download pocket_client 0.1.0 archive

Analysis

This feature is new.
We welcome feedback.
More details: scoring.

We analyzed this package, and provided a score, details, and suggestions below.

  • completed on Feb 3, 2018
  • Dart: 2.0.0-dev.20.0
  • pana: 0.10.1

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
0 / 100
Health:
Code health derived from static analysis. [more]
98 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
95 / 100
Overall score:
Weighted score of the above. [more]
48

Platforms

Detected platforms: Flutter, web, other

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

Suggestions

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Use analysis_options.yaml.

    Rename old .analysis_options file to analysis_options.yaml.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.21.0
http >=0.11.3+2 <0.12.0 0.11.3+16
Transitive dependencies
async 2.0.3
charcode 1.1.1
collection 1.14.5
http_parser 3.1.1
path 1.5.1
source_span 1.4.0
string_scanner 1.0.2
typed_data 1.1.5
Dev dependencies
test >=0.12.0 <0.13.0