pocket_client 0.1.1 copy "pocket_client: ^0.1.1" to clipboard
pocket_client: ^0.1.1 copied to clipboard

outdatedDart 1 only

A library for authenticating and accessing the Pocket API from Dart

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 = '46535-b86e702df57f222f8363f4e3';
const redirectUrl = 'http://some.redirect.uri/autorizationFinished';
const accessToken = '5678defg-5678-defg-5678-defg56';

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

//	var requestToken;
//	var requestToken = '2bdf11cc-52c5-11e9-fa0b-5cbf68';
//
//	authentication.getRequestToken(redirectUrl).then((code) {
//		requestToken = code;
//
//		var url = ClientAuthentication.getAuthorizeUrl(requestToken, redirectUrl);
//		// work whatever redirect magic you need here
//		print(url);
//	});

	//..

//	authentication.getAccessToken(requestToken).then(onAuthorizationFinished);

	onAuthorizationFinished(null);
}

onAuthorizationFinished(User userData) {

	var dataAccessToken = 'ad358de4-5603-7bfb-6702-95f4ec';

//	print(dataAccessToken);

	var client = new Client(consumerKey, dataAccessToken);

	var options = new RetrieveOptions()
		..detailType = DetailType.complete
		..state = State.all
		..tag = 'cats';
//	5843744
//
	client
	.renameTag(5843744, 'cats', 'dogs')
	.then((ActionResults result) {
		print(result);
		// ...
//		client.getData(options: options).then((PocketResponse response) {
//			Map<String, PocketData> items = response.items;
//		});
	});

//	client.getData(options: options).then((PocketResponse response) {
//		Map<String, PocketData> items = response.items;
//	});
//

//	var newItem = new ItemToAdd('http://www.funnycatpix.com/')
//		..title = 'FUNNY CAT PICTURES'
//		..tweetId = '123456'
//		..tags = ['cats', 'cool', 'share'];
//
//	client.addItem(newItem).then((PocketData data) {
//		print(data);
//		// do whatever you want with received data
//	});
}
0
likes
40
pub points
0%
popularity

Publisher

unverified uploader

A library for authenticating and accessing the Pocket API from Dart

Homepage

Documentation

Documentation

License

BSD-3-Clause (LICENSE)

Dependencies

http

More

Packages that depend on pocket_client