pocket_client 0.1.2

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

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
}

Use this package as a library

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

Alternatively, your editor might support pub 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
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
--
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
--
Overall:
Weighted score of the above. [more]
0
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://www.dartlang.org/dart-2#migration.

Maintenance issues and suggestions

Make sure dartdoc successfully runs on your package's source files. (-10 points)

Dependencies were not resolved.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.21.0