pindo 1.0.2 copy "pindo: ^1.0.2" to clipboard
pindo: ^1.0.2 copied to clipboard

A wrapper to use all the functions of the Pindo API written in Dart.

Pindo-Dart #

Pindo codecov style: very good analysis License: MIT Pub

A wrapper for the Pindo API written in Dart.

Click here to learn more about Pindo.

To see the example app, open https://pindo-client.netlify.app

Getting Started #


Add the dependency

dependendies:
  pindo: ^1.0.2
copied to clipboard

Usage #


You need a Pindo() object to use all the functionalities offered by the API. Pindo-Dart uses Dio under the hood to handle http requests. If you are using Dio in your app and already have a Dio object initialized, reusing it is recommended but not required while initializing a new Pindo().

// If you are working with `Dio` in your app, you can use
final dio = Dio();
final pindo = Pindo(dio:dio)

// If you are not using `Dio` or simply don't wanna use it in your Pindo object, use
final pindo = Pindo();
copied to clipboard

Registration #

To create a new Pindo account, use the function register that takes a username, an email and a password as parameters (all of them are as strings and required).

import 'package:pindo/pindo.dart';
Future<void> main() async{
    final pindo = Pindo();
    await pindo.register(
      username:'pindo',
      email:'pindo@test.com',
      password: 'awesome-password'
    ).then((_)=>print('Logged in')).onError((e,s)=>print('$e'));
}
copied to clipboard

Token #

To get the user's token, use the function getToken that takes a username and a password (all as string and required); and returns the token(string).

import 'package:pindo/pindo.dart';
Future<void> main() async{
  final pindo = Pindo();
  await pindo.getToken(
    username:'pindo',
    password:'awesome-password'
  ).then((token)=>print(token)).onError((e,s)=>print('$e'));
}
copied to clipboard

Refresh Token #

To refresh the user's token, use the function refreshToken that takes a username and a password(all as string and required); and returns the refreshed token(string).

import 'package:pindo/pindo.dart';
Future<void> main() async{
  final pindo = Pindo();
  await pindo.refreshToken(
    username:'pindo',
    password:'awesome-password'
  ).then((token)=>print(token)).onError((e,s)=>print('$e'));
}
copied to clipboard

Balance #

To get the user's balance, use the function balance that takes the user's token and returns their balance(double).

import 'package:pindo/pindo.dart';
Future<void> main() async{
  final pindo = Pindo();
  await pindo.balance(
    token:'awesomest-token-in-the-entire-world',
  ).then((balance)=>print('$balance')).onError((e,s)=>print('$e'));
}
copied to clipboard

SMS #

To send an SMS, use the function sendSMS that takes the parameters: token(sender's token), to(the receiver's phone number), from(the sender's name), and text(the sms body) all of them as strings. This function returns the user's remaining balance after they have sent the SMS.

import 'package:pindo/pindo.dart';
Future<void> main() async{
  final pindo = Pindo();
  await pindo.sendSMS(
    token:'<my-token>',
    to: '<my-phone-number>',
    from: 'Pindo',
    text: 'Hello Pindo',
  ).then((balance)=>print('$balance')).onError((e,s)=>print('$e'));
}
copied to clipboard

Organization #

To update a pindo organization, use the function organization which takes four parameters: a token(String), the organization name(String), a webhook url(String) and the number of retries(int). This function returns the organization's URL.

import 'package:pindo/pindo.dart';
Future<void> main() async{
  final pindo = Pindo();
  await pindo.organization(
    token: '<my-token>',
    name: '<org-name>',
    webHookURL: 'https://example.com/hook',
    retriesCount: 7,
    ).then((url)=>print(url)).onError((e,s)=>print('$e'));
}
copied to clipboard

Forgot Password #

To send the user an email to reset their password, use the function forgotPassword which takes one parameter: the user's email addrres.

import 'package:pindo/pindo.dart';
  Future<void> main()async{
    final pindo = Pindo();
    await pindo.forgotPassword(email: 'tester@test.com').then(
    (_)=>print('Email sent')).onError((e,s)=>print('$e'));
  }
copied to clipboard

Contribution #

Please make sure your code is tested before pushing

About Pindo #

Visit the website here; or check the Pindo on Github.

Author #

Boris Kayi

5
likes
150
points
19
downloads

Publisher

verified publishersilverhairs.dev

Weekly Downloads

2024.10.02 - 2025.04.16

A wrapper to use all the functions of the Pindo API written in Dart.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

dio, meta

More

Packages that depend on pindo