owo 1.0.6

  • Readme
  • Changelog
  • Example
  • Installing
  • new57

An API wrapper for https://whats-th.is/ written in Dart

Example:

import 'dart:io';

import 'package:owo/src/client.dart';
void main(List<String> args) async {
/// Initialize the client with your API key and optional 
/// custom url (Visit https://whats-th.is/faq.html for more info about this)
  var owo = OwOClient(
      apiKey: 'YOUR API KEY',
      customUrl: 'https://bad-me.me');

/// !!!!!!!!!!!!!!!!  VERY IMPORTANT TO INIT THE CLIENT TO SET HEADERS !!!!!!!!!!!!!!!!!!!!!!!!
  await owo.init(); //////////
//////////////////////////////



/// l => left, which holds errors for every method
/// r => right, which holds result for every method

/// Uploading the file(s)
  var resp =
      await owo.upload(files: [File('/full/path/to/the/file.file_extension')]);
  resp.fold((l) {
    print(l.errorcode);
  }, (r) {
    r.files.forEach((element) {
      print(element.url);
    });
  });
  
  /// Shortening any URL
  var key = await owo.shorten(url: 'https://metaboy.info');
  key.fold((l) => print(l.description), (r) => print(r));

/// Getting all objects for the api key in context
  var objects = await owo.getAllObjects();
  objects.fold((l) => print(l.description), (r) => r.data.forEach((element) {
    print(element.key);
  }));
  
/// Getting an object with specified key
var object = await owo.getObject(key: '2xEGFFw.png');
  object.fold((l) => print(l.description), (r) => print(r.data.key));
  
/// Deleting an object with specfied key
  var delete = await owo.deleteObject(key: '2xEGFFw.png');
  delete.fold((l) => print(l.description), (r) => print(r.data.deleteReason));
}

1.0.0 #

  • Initial version, created by Stagehand

1.0.1 #

  • Initial functional version

1.0.2 #

  • added documentation

1.0.3 #

  • made API key private
  • updated url to get available domains

1.0.4 #

  • Now returns objects with default urls
  • Added proper header

1.0.5 #

  • Minor hotfix

1.0.6 #

  • Fixing the fix

example/owo_example.dart

import 'dart:io';

import 'package:owo/src/client.dart';
void main(List<String> args) async {
/// Initialize the client with your API key and optional 
/// custom url (Visit https://whats-th.is/faq.html for more info about this)
  var owo = OwOClient(
      apiKey: 'YOUR API KEY',
      customUrl: 'https://bad-me.me');

/// !!!!!!!!!!!!!!!!  VERY IMPORTANT TO INIT THE CLIENT TO SET HEADERS !!!!!!!!!!!!!!!!!!!!!!!!
  await owo.init(); //////////
//////////////////////////////



/// l => left, which holds errors for every method
/// r => right, which holds result for every method

/// Uploading the file(s)
  var resp =
      await owo.upload(files: [File('/full/path/to/the/file.file_extension')]);
  resp.fold((l) {
    print(l.errorcode);
  }, (r) {
    r.files.forEach((element) {
      print(element.url);
    });
  });
  
  /// Shortening any URL
  var key = await owo.shorten(url: 'https://metaboy.info');
  key.fold((l) => print(l.description), (r) => print(r));

/// Getting all objects for the api key in context
  var objects = await owo.getAllObjects();
  objects.fold((l) => print(l.description), (r) => r.data.forEach((element) {
    print(element.key);
  }));
  
/// Getting an object with specified key
var object = await owo.getObject(key: '2xEGFFw.png');
  object.fold((l) => print(l.description), (r) => print(r.data.key));
  
/// Deleting an object with specfied key
  var delete = await owo.deleteObject(key: '2xEGFFw.png');
  delete.fold((l) => print(l.description), (r) => print(r.data.deleteReason));
}

Use this package as a library

1. Depend on it

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


dependencies:
  owo: ^1.0.6

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:owo/owo.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
23
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
57
Learn more about scoring.

We analyzed this package on May 24, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.1
  • pana: 0.13.8-dev

Health suggestions

Fix lib/src/client.dart. (-1 points)

Analysis of lib/src/client.dart reported 2 hints:

line 4 col 8: Duplicate import.

line 135 col 12: The parameter 'apiKey' is required.

Format lib/owo.dart.

Run dartfmt to format lib/owo.dart.

Format lib/src/core/errors/exceptions.dart.

Run dartfmt to format lib/src/core/errors/exceptions.dart.

Fix additional 4 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/core/errors/failures.dart (Run dartfmt to format lib/src/core/errors/failures.dart.)
  • lib/src/core/models/objects_model.dart (Run dartfmt to format lib/src/core/models/objects_model.dart.)
  • lib/src/utils/constants.dart (Run dartfmt to format lib/src/utils/constants.dart.)
  • lib/src/utils/functions.dart (Run dartfmt to format lib/src/utils/functions.dart.)

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
dartz ^0.9.0 0.9.1
http ^0.12.1 0.12.1
meta ^1.1.8 1.1.8
yaml ^2.2.1 2.2.1
Transitive dependencies
charcode 1.1.3
collection 1.14.12
http_parser 3.1.4
path 1.7.0
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies
import_sorter ^2.0.1
pedantic ^1.8.0 1.9.0
test ^1.6.0